Created
November 16, 2016 05:33
-
-
Save DanSnow/5deacc55e4864b70d772eaf6e81ea58b to your computer and use it in GitHub Desktop.
Wrapper for jasmine-immutable-matchers to make it work on jest > 17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as jasmineImmutable from 'jasmine-immutable-matchers' | |
import mapValues from 'lodash/mapValues' | |
const jestImmutable = mapValues(jasmineImmutable, (matcherFactory) => { | |
const matcher = matcherFactory() | |
return function () { | |
const { isNot } = this | |
const { pass, message } = matcher[isNot ? 'negativeCompare' : 'compare'](...arguments) | |
return { | |
pass: Boolean(pass), | |
message | |
} | |
} | |
}) | |
expect.extend(jestImmutable) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment