Skip to content

Commit c2f905e

Browse files
committed
refactor generic utility error handling tests
1 parent e4abc9f commit c2f905e

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

test/utils/generic.spec.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ describe('Generic Utilities', () => {
3131
})
3232

3333
it('should throw a type error when not passed an object literal', () => {
34+
let caught
3435
try {
3536
deepAssign(null, null)
3637
} catch (error) {
37-
expect(error).to.be.an.instanceof(TypeError)
38+
caught = error
3839
}
40+
expect(caught).to.exist
41+
expect(caught).to.be.an.instanceof(TypeError)
3942
})
4043
})
4144

@@ -63,11 +66,14 @@ describe('Generic Utilities', () => {
6366
})
6467

6568
it('should throw a type error when not passed an object literal', () => {
69+
let caught
6670
try {
6771
deepEqual(null, null)
6872
} catch (error) {
69-
expect(error).to.be.an.instanceof(TypeError)
73+
caught = error
7074
}
75+
expect(caught).to.exist
76+
expect(caught).to.be.an.instanceof(TypeError)
7177
})
7278
})
7379

@@ -122,11 +128,14 @@ describe('Generic Utilities', () => {
122128
})
123129

124130
it('should throw a type error when not passed an object literal', () => {
131+
let caught
125132
try {
126133
forOwn(null, () => {})
127134
} catch (error) {
128-
expect(error).to.be.an.instanceof(TypeError)
135+
caught = error
129136
}
137+
expect(caught).to.exist
138+
expect(caught).to.be.an.instanceof(TypeError)
130139
})
131140
})
132141

0 commit comments

Comments
 (0)