From e49dff508812650649c003ef08c0616ff3cd7451 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 28 May 2019 11:05:39 +0200 Subject: [PATCH] Split up tests --- src/__tests__/object.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/__tests__/object.test.js b/src/__tests__/object.test.js index c7766bab..b371abf6 100644 --- a/src/__tests__/object.test.js +++ b/src/__tests__/object.test.js @@ -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'); });