Skip to content

Commit

Permalink
chore: remove jest-matcher-utils in favor of jest this.utils
Browse files Browse the repository at this point in the history
  • Loading branch information
iamandrewluca committed Apr 7, 2020
1 parent e651e2b commit 94b01de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"immutable": "^3.8.2",
"insert-line": "^1.1.0",
"jest": "^24.9.0",
"jest-matcher-utils": "^24.9.0",
"lint-staged": "^8.2.1",
"lodash-webpack-plugin": "^0.11.5",
"prettier": "^1.19.1",
Expand Down
18 changes: 7 additions & 11 deletions src/structure/immutable/__tests__/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import deepEqual from 'deep-equal'
import { Map, List, Iterable, fromJS } from 'immutable'

import { matcherHint, printReceived, printExpected } from 'jest-matcher-utils'

const deepEqualValues = (a: any, b: any) => {
if (Iterable.isIterable(a)) {
return (
Expand Down Expand Up @@ -45,12 +43,12 @@ const api = {
return {
pass,
message: () =>
matcherHint('.toEqualMap') +
this.utils.matcherHint('.toEqualMap') +
'\n\n' +
`Expected value to equal map:\n` +
` ${printExpected(fromJS(expected))}\n` +
` ${this.utils.printExpected(fromJS(expected))}\n` +
`Received:\n` +
` ${printReceived(actual)}`
` ${this.utils.printReceived(actual)}`
}
},

Expand All @@ -59,20 +57,18 @@ const api = {
const pass =
actual.length === expected.length &&
actual.every(actualItem =>
expectedItems.some(expectedItem =>
deepEqualValues(actualItem, expectedItem)
)
expectedItems.some(expectedItem => deepEqualValues(actualItem, expectedItem))
)

return {
pass,
message: () =>
matcherHint('.toContainExactly') +
this.utils.matcherHint('.toContainExactly') +
'\n\n' +
`Expected value to contain:\n` +
` ${printExpected(fromJS(expected))}\n` +
` ${this.utils.printExpected(fromJS(expected))}\n` +
`Received:\n` +
` ${printReceived(actual)}`
` ${this.utils.printReceived(actual)}`
}
}
}
Expand Down
13 changes: 6 additions & 7 deletions src/structure/plain/__tests__/expectations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
import { isEqual, isObject } from 'lodash'
import { matcherHint, printReceived, printExpected } from 'jest-matcher-utils'

const expectations = {
toBeAMap(actual: any) {
Expand Down Expand Up @@ -32,12 +31,12 @@ const expectations = {
return {
pass,
message: () =>
matcherHint('.toEqualMap') +
this.utils.matcherHint('.toEqualMap') +
'\n\n' +
`Expected value to equal:\n` +
` ${printExpected(expected)}\n` +
` ${this.utils.printExpected(expected)}\n` +
`Received:\n` +
` ${printReceived(actual)}`
` ${this.utils.printReceived(actual)}`
}
},

Expand All @@ -51,12 +50,12 @@ const expectations = {
return {
pass,
message: () =>
matcherHint('.toContainExactly') +
this.utils.matcherHint('.toContainExactly') +
'\n\n' +
`Expected value to contain:\n` +
` ${printExpected(sortedExpected)}\n` +
` ${this.utils.printExpected(sortedExpected)}\n` +
`Received:\n` +
` ${printReceived(sortedActual)}`
` ${this.utils.printReceived(sortedActual)}`
}
}
}
Expand Down

0 comments on commit 94b01de

Please sign in to comment.