Skip to content

Commit e8d5ddc

Browse files
kevin940726markerikson
authored andcommitted
Mock the console manually (#281)
1 parent 0f4cdf2 commit e8d5ddc

File tree

3 files changed

+46
-16
lines changed

3 files changed

+46
-16
lines changed

package-lock.json

Lines changed: 33 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@types/jest": "^24.0.11",
2828
"@types/node": "^10.14.4",
2929
"@types/redux-immutable-state-invariant": "^2.1.1",
30-
"console-testing-library": "^0.2.2",
30+
"console-testing-library": "^0.3.1",
3131
"eslint-config-react-app": "^5.0.1",
3232
"prettier": "^1.18.2",
3333
"react": "^16.8.6",

src/serializableStateInvariantMiddleware.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { Reducer } from 'redux'
2-
import { getLog } from 'console-testing-library'
2+
import {
3+
mockConsole,
4+
createConsole,
5+
getLog
6+
} from 'console-testing-library/pure'
37
import { configureStore } from './configureStore'
48

59
import {
@@ -8,6 +12,13 @@ import {
812
isPlain
913
} from './serializableStateInvariantMiddleware'
1014

15+
// Mocking console
16+
let restore = () => {}
17+
beforeEach(() => {
18+
restore = mockConsole(createConsole())
19+
})
20+
afterEach(() => restore())
21+
1122
describe('findNonSerializableValue', () => {
1223
it('Should return false if no matching values are found', () => {
1324
const obj = {

0 commit comments

Comments
 (0)