Skip to content

Commit 98735c8

Browse files
committed
test(effect): stub console.error
1 parent 53246f9 commit 98735c8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/specs/effect.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ describe('Effect spec:', () => {
105105

106106
describe('Error handles', () => {
107107
it(`Error won't affect the main state$`, () => {
108+
const errorLog = jest.spyOn(console, 'error').mockImplementation(() => {})
108109
countActions.error()
110+
expect(errorLog.mock.calls.length).toBe(1)
111+
errorLog.mockRestore()
112+
109113
countActions.add(1)
110-
countActions.minus(1)
111-
countActions.minus(1)
112-
expect(getCount()).toBe(-1)
114+
countActions.minus(2)
115+
countActions.minus(3)
116+
expect(getCount()).toBe(-4)
113117
})
114118
})
115119
})

0 commit comments

Comments
 (0)