Skip to content

Commit

Permalink
chore(validate): test for FailedYahooValErr.{result,errors} (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 5, 2021
1 parent 46481b0 commit afe3347
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib/validateAndCoerceTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ describe('validateAndCoerceTypes', () => {
expect(fakeConsole.dir).not.toHaveBeenCalled();
});

it('returns results/errors in error object', () => {
const result = { nonExistingModule: true };

let error;
try {
validateAndCoerceTypes(result, QUERY_RESULT_SCHEMA_KEY)
} catch (e) {
error = e;
}

expect(error).toBeDefined();
expect(error.message).toMatch(/Failed Yahoo/);
expect(error.result).toBe(result);
expect(error.errors).toBeType('array');
});

});

});
Expand Down

0 comments on commit afe3347

Please sign in to comment.