Skip to content

Commit

Permalink
Split up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed May 28, 2019
1 parent 17bb693 commit e49dff5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/__tests__/object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ describe('arrays are not objects', () => {
expect(guard(decoder2)({ what: 'ever' })).toEqual({});
});

it('invalid', () => {
it('invalid (basic types)', () => {
expect(() => guard(decoder1)([])).toThrow('Must be an object');
expect(() => guard(decoder2)([])).toThrow('Must be an object');
expect(() => guard(decoder1)('an string')).toThrow('Must be an object');
expect(() => guard(decoder2)('an string')).toThrow('Must be an object');
});

it('invalid (custom classes)', () => {
expect(() => guard(decoder1)(new String())).toThrow('Must be an object');
expect(() => guard(decoder2)(new String())).toThrow('Must be an object');
expect(() => guard(decoder1)(new Error('foo'))).toThrow('Must be an object');
expect(() => guard(decoder2)(new Error('foo'))).toThrow('Must be an object');
expect(() => guard(decoder1)(new Date())).toThrow('Must be an object');
expect(() => guard(decoder2)(new Date())).toThrow('Must be an object');
});
Expand Down

0 comments on commit e49dff5

Please sign in to comment.