jest-extended
Advanced tools
Comparing version 0.7.2 to 0.8.0
'use strict'; | ||
var _chalk = require('chalk'); | ||
var _matchers = require('./matchers'); | ||
@@ -17,4 +15,4 @@ | ||
/* eslint-disable no-console */ | ||
console.error((0, _chalk.red)("Unable to find Jest's global expect." + '\nPlease check you have added jest-extended correctly to your jest configuration.' + '\nSee https://github.com/mattphillips/jest-extended#setup for help.')); | ||
console.error("Unable to find Jest's global expect." + '\nPlease check you have added jest-extended correctly to your jest configuration.' + '\nSee https://github.com/mattphillips/jest-extended#setup for help.'); | ||
/* eslint-enable no-console */ | ||
} |
@@ -9,184 +9,262 @@ 'use strict'; | ||
var _toBeEven = require('./toBeEven'); | ||
var _index = require('./toBeAfter/index.js'); | ||
var _toBeEven2 = _interopRequireDefault(_toBeEven); | ||
var _toBeAfterIndexJs = _interopRequireWildcard(_index); | ||
var _toBeTrue = require('./toBeTrue'); | ||
var _index2 = require('./toBeArray/index.js'); | ||
var _toBeTrue2 = _interopRequireDefault(_toBeTrue); | ||
var _toBeArrayIndexJs = _interopRequireWildcard(_index2); | ||
var _toSatisfy = require('./toSatisfy'); | ||
var _index3 = require('./toBeArrayOfSize/index.js'); | ||
var _toSatisfy2 = _interopRequireDefault(_toSatisfy); | ||
var _toBeArrayOfSizeIndexJs = _interopRequireWildcard(_index3); | ||
var _toBeFalse = require('./toBeFalse'); | ||
var _index4 = require('./toBeBefore/index.js'); | ||
var _toBeFalse2 = _interopRequireDefault(_toBeFalse); | ||
var _toBeBeforeIndexJs = _interopRequireWildcard(_index4); | ||
var _toContainValue = require('./toContainValue'); | ||
var _index5 = require('./toBeBoolean/index.js'); | ||
var _toContainValue2 = _interopRequireDefault(_toContainValue); | ||
var _toBeBooleanIndexJs = _interopRequireWildcard(_index5); | ||
var _toContainValues = require('./toContainValues'); | ||
var _index6 = require('./toBeDate/index.js'); | ||
var _toContainValues2 = _interopRequireDefault(_toContainValues); | ||
var _toBeDateIndexJs = _interopRequireWildcard(_index6); | ||
var _toBeArray = require('./toBeArray'); | ||
var _index7 = require('./toBeEmpty/index.js'); | ||
var _toBeArray2 = _interopRequireDefault(_toBeArray); | ||
var _toBeEmptyIndexJs = _interopRequireWildcard(_index7); | ||
var _toBeArrayOfSize = require('./toBeArrayOfSize'); | ||
var _index8 = require('./toBeEven/index.js'); | ||
var _toBeArrayOfSize2 = _interopRequireDefault(_toBeArrayOfSize); | ||
var _toBeEvenIndexJs = _interopRequireWildcard(_index8); | ||
var _toEqualCaseInsensitive = require('./toEqualCaseInsensitive'); | ||
var _index9 = require('./toBeExtensible/index.js'); | ||
var _toEqualCaseInsensitive2 = _interopRequireDefault(_toEqualCaseInsensitive); | ||
var _toBeExtensibleIndexJs = _interopRequireWildcard(_index9); | ||
var _toStartWith = require('./toStartWith'); | ||
var _index10 = require('./toBeFalse/index.js'); | ||
var _toStartWith2 = _interopRequireDefault(_toStartWith); | ||
var _toBeFalseIndexJs = _interopRequireWildcard(_index10); | ||
var _toBeNegative = require('./toBeNegative'); | ||
var _index11 = require('./toBeFinite/index.js'); | ||
var _toBeNegative2 = _interopRequireDefault(_toBeNegative); | ||
var _toBeFiniteIndexJs = _interopRequireWildcard(_index11); | ||
var _toBeOneOf = require('./toBeOneOf'); | ||
var _index12 = require('./toBeFrozen/index.js'); | ||
var _toBeOneOf2 = _interopRequireDefault(_toBeOneOf); | ||
var _toBeFrozenIndexJs = _interopRequireWildcard(_index12); | ||
var _toContainKey = require('./toContainKey'); | ||
var _index13 = require('./toBeFunction/index.js'); | ||
var _toContainKey2 = _interopRequireDefault(_toContainKey); | ||
var _toBeFunctionIndexJs = _interopRequireWildcard(_index13); | ||
var _toBeString = require('./toBeString'); | ||
var _index14 = require('./toBeNaN/index.js'); | ||
var _toBeString2 = _interopRequireDefault(_toBeString); | ||
var _toBeNaNIndexJs = _interopRequireWildcard(_index14); | ||
var _toBeExtensible = require('./toBeExtensible'); | ||
var _index15 = require('./toBeNegative/index.js'); | ||
var _toBeExtensible2 = _interopRequireDefault(_toBeExtensible); | ||
var _toBeNegativeIndexJs = _interopRequireWildcard(_index15); | ||
var _toBeWithin = require('./toBeWithin'); | ||
var _index16 = require('./toBeNil/index.js'); | ||
var _toBeWithin2 = _interopRequireDefault(_toBeWithin); | ||
var _toBeNilIndexJs = _interopRequireWildcard(_index16); | ||
var _toIncludeMultiple = require('./toIncludeMultiple'); | ||
var _index17 = require('./toBeNumber/index.js'); | ||
var _toIncludeMultiple2 = _interopRequireDefault(_toIncludeMultiple); | ||
var _toBeNumberIndexJs = _interopRequireWildcard(_index17); | ||
var _toEndWith = require('./toEndWith'); | ||
var _index18 = require('./toBeObject/index.js'); | ||
var _toEndWith2 = _interopRequireDefault(_toEndWith); | ||
var _toBeObjectIndexJs = _interopRequireWildcard(_index18); | ||
var _toBeFrozen = require('./toBeFrozen'); | ||
var _index19 = require('./toBeOdd/index.js'); | ||
var _toBeFrozen2 = _interopRequireDefault(_toBeFrozen); | ||
var _toBeOddIndexJs = _interopRequireWildcard(_index19); | ||
var _toBeObject = require('./toBeObject'); | ||
var _index20 = require('./toBeOneOf/index.js'); | ||
var _toBeObject2 = _interopRequireDefault(_toBeObject); | ||
var _toBeOneOfIndexJs = _interopRequireWildcard(_index20); | ||
var _toContainAllKeys = require('./toContainAllKeys'); | ||
var _index21 = require('./toBePositive/index.js'); | ||
var _toContainAllKeys2 = _interopRequireDefault(_toContainAllKeys); | ||
var _toBePositiveIndexJs = _interopRequireWildcard(_index21); | ||
var _toContainAnyKeys = require('./toContainAnyKeys'); | ||
var _index22 = require('./toBeSealed/index.js'); | ||
var _toContainAnyKeys2 = _interopRequireDefault(_toContainAnyKeys); | ||
var _toBeSealedIndexJs = _interopRequireWildcard(_index22); | ||
var _toContainKeys = require('./toContainKeys'); | ||
var _index23 = require('./toBeString/index.js'); | ||
var _toContainKeys2 = _interopRequireDefault(_toContainKeys); | ||
var _toBeStringIndexJs = _interopRequireWildcard(_index23); | ||
var _toBeFinite = require('./toBeFinite'); | ||
var _index24 = require('./toBeTrue/index.js'); | ||
var _toBeFinite2 = _interopRequireDefault(_toBeFinite); | ||
var _toBeTrueIndexJs = _interopRequireWildcard(_index24); | ||
var _toIncludeAnyMembers = require('./toIncludeAnyMembers'); | ||
var _index25 = require('./toBeValidDate/index.js'); | ||
var _toIncludeAnyMembers2 = _interopRequireDefault(_toIncludeAnyMembers); | ||
var _toBeValidDateIndexJs = _interopRequireWildcard(_index25); | ||
var _toIncludeAllMembers = require('./toIncludeAllMembers'); | ||
var _index26 = require('./toBeWithin/index.js'); | ||
var _toIncludeAllMembers2 = _interopRequireDefault(_toIncludeAllMembers); | ||
var _toBeWithinIndexJs = _interopRequireWildcard(_index26); | ||
var _toBeNaN = require('./toBeNaN'); | ||
var _index27 = require('./toContainAllEntries/index.js'); | ||
var _toBeNaN2 = _interopRequireDefault(_toBeNaN); | ||
var _toContainAllEntriesIndexJs = _interopRequireWildcard(_index27); | ||
var _toBePositive = require('./toBePositive'); | ||
var _index28 = require('./toContainAllKeys/index.js'); | ||
var _toBePositive2 = _interopRequireDefault(_toBePositive); | ||
var _toContainAllKeysIndexJs = _interopRequireWildcard(_index28); | ||
var _toInclude = require('./toInclude'); | ||
var _index29 = require('./toContainAllValues/index.js'); | ||
var _toInclude2 = _interopRequireDefault(_toInclude); | ||
var _toContainAllValuesIndexJs = _interopRequireWildcard(_index29); | ||
var _toBeBoolean = require('./toBeBoolean'); | ||
var _index30 = require('./toContainAnyEntries/index.js'); | ||
var _toBeBoolean2 = _interopRequireDefault(_toBeBoolean); | ||
var _toContainAnyEntriesIndexJs = _interopRequireWildcard(_index30); | ||
var _toBeFunction = require('./toBeFunction'); | ||
var _index31 = require('./toContainAnyKeys/index.js'); | ||
var _toBeFunction2 = _interopRequireDefault(_toBeFunction); | ||
var _toContainAnyKeysIndexJs = _interopRequireWildcard(_index31); | ||
var _toBeNumber = require('./toBeNumber'); | ||
var _index32 = require('./toContainAnyValues/index.js'); | ||
var _toBeNumber2 = _interopRequireDefault(_toBeNumber); | ||
var _toContainAnyValuesIndexJs = _interopRequireWildcard(_index32); | ||
var _toBeOdd = require('./toBeOdd'); | ||
var _index33 = require('./toContainEntries/index.js'); | ||
var _toBeOdd2 = _interopRequireDefault(_toBeOdd); | ||
var _toContainEntriesIndexJs = _interopRequireWildcard(_index33); | ||
var _toContainAllValues = require('./toContainAllValues'); | ||
var _index34 = require('./toContainEntry/index.js'); | ||
var _toContainAllValues2 = _interopRequireDefault(_toContainAllValues); | ||
var _toContainEntryIndexJs = _interopRequireWildcard(_index34); | ||
var _toContainEntry = require('./toContainEntry'); | ||
var _index35 = require('./toContainKey/index.js'); | ||
var _toContainEntry2 = _interopRequireDefault(_toContainEntry); | ||
var _toContainKeyIndexJs = _interopRequireWildcard(_index35); | ||
var _toContainAllEntries = require('./toContainAllEntries'); | ||
var _index36 = require('./toContainKeys/index.js'); | ||
var _toContainAllEntries2 = _interopRequireDefault(_toContainAllEntries); | ||
var _toContainKeysIndexJs = _interopRequireWildcard(_index36); | ||
var _toContainEntries = require('./toContainEntries'); | ||
var _index37 = require('./toContainValue/index.js'); | ||
var _toContainEntries2 = _interopRequireDefault(_toContainEntries); | ||
var _toContainValueIndexJs = _interopRequireWildcard(_index37); | ||
var _toContainAnyEntries = require('./toContainAnyEntries'); | ||
var _index38 = require('./toContainValues/index.js'); | ||
var _toContainAnyEntries2 = _interopRequireDefault(_toContainAnyEntries); | ||
var _toContainValuesIndexJs = _interopRequireWildcard(_index38); | ||
var _toContainAnyValues = require('./toContainAnyValues'); | ||
var _index39 = require('./toEndWith/index.js'); | ||
var _toContainAnyValues2 = _interopRequireDefault(_toContainAnyValues); | ||
var _toEndWithIndexJs = _interopRequireWildcard(_index39); | ||
var _toBeNil = require('./toBeNil'); | ||
var _index40 = require('./toEqualCaseInsensitive/index.js'); | ||
var _toBeNil2 = _interopRequireDefault(_toBeNil); | ||
var _toEqualCaseInsensitiveIndexJs = _interopRequireWildcard(_index40); | ||
var _toSatisfyAll = require('./toSatisfyAll'); | ||
var _index41 = require('./toHaveBeenCalledAfter/index.js'); | ||
var _toSatisfyAll2 = _interopRequireDefault(_toSatisfyAll); | ||
var _toHaveBeenCalledAfterIndexJs = _interopRequireWildcard(_index41); | ||
var _toBeEmpty = require('./toBeEmpty'); | ||
var _index42 = require('./toHaveBeenCalledBefore/index.js'); | ||
var _toBeEmpty2 = _interopRequireDefault(_toBeEmpty); | ||
var _toHaveBeenCalledBeforeIndexJs = _interopRequireWildcard(_index42); | ||
var _toBeSealed = require('./toBeSealed'); | ||
var _index43 = require('./toInclude/index.js'); | ||
var _toBeSealed2 = _interopRequireDefault(_toBeSealed); | ||
var _toIncludeIndexJs = _interopRequireWildcard(_index43); | ||
var _toIncludeRepeated = require('./toIncludeRepeated'); | ||
var _index44 = require('./toIncludeAllMembers/index.js'); | ||
var _toIncludeRepeated2 = _interopRequireDefault(_toIncludeRepeated); | ||
var _toIncludeAllMembersIndexJs = _interopRequireWildcard(_index44); | ||
var _toHaveBeenCalledBefore = require('./toHaveBeenCalledBefore'); | ||
var _index45 = require('./toIncludeAnyMembers/index.js'); | ||
var _toHaveBeenCalledBefore2 = _interopRequireDefault(_toHaveBeenCalledBefore); | ||
var _toIncludeAnyMembersIndexJs = _interopRequireWildcard(_index45); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _index46 = require('./toIncludeMultiple/index.js'); | ||
exports.default = [_toBeEven2.default, _toBeTrue2.default, _toBeFalse2.default, _toContainValue2.default, _toContainValues2.default, _toBeArray2.default, _toBeArrayOfSize2.default, _toEqualCaseInsensitive2.default, _toStartWith2.default, _toBeNegative2.default, _toBeOneOf2.default, _toContainKey2.default, _toBeExtensible2.default, _toBeString2.default, _toBeWithin2.default, _toIncludeMultiple2.default, _toEndWith2.default, _toBeFrozen2.default, _toBeObject2.default, _toContainAllKeys2.default, _toContainAnyKeys2.default, _toContainKeys2.default, _toBeFinite2.default, _toIncludeAnyMembers2.default, _toIncludeAllMembers2.default, _toBeNaN2.default, _toBePositive2.default, _toInclude2.default, _toBeBoolean2.default, _toBeFunction2.default, _toBeNumber2.default, _toBeOdd2.default, _toContainAllValues2.default, _toContainEntry2.default, _toContainAllEntries2.default, _toContainEntries2.default, _toContainAnyEntries2.default, _toContainAnyValues2.default, _toBeNil2.default, _toSatisfyAll2.default, _toBeEmpty2.default, _toBeSealed2.default, _toSatisfy2.default, _toIncludeRepeated2.default, _toHaveBeenCalledBefore2.default].reduce((acc, matcher) => _extends({}, acc, matcher), {}); | ||
var _toIncludeMultipleIndexJs = _interopRequireWildcard(_index46); | ||
var _index47 = require('./toIncludeRepeated/index.js'); | ||
var _toIncludeRepeatedIndexJs = _interopRequireWildcard(_index47); | ||
var _index48 = require('./toIncludeSameMembers/index.js'); | ||
var _toIncludeSameMembersIndexJs = _interopRequireWildcard(_index48); | ||
var _index49 = require('./toSatisfy/index.js'); | ||
var _toSatisfyIndexJs = _interopRequireWildcard(_index49); | ||
var _index50 = require('./toSatisfyAll/index.js'); | ||
var _toSatisfyAllIndexJs = _interopRequireWildcard(_index50); | ||
var _index51 = require('./toStartWith/index.js'); | ||
var _toStartWithIndexJs = _interopRequireWildcard(_index51); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
const imports = { | ||
'./toBeAfter/index.js': _toBeAfterIndexJs, | ||
'./toBeArray/index.js': _toBeArrayIndexJs, | ||
'./toBeArrayOfSize/index.js': _toBeArrayOfSizeIndexJs, | ||
'./toBeBefore/index.js': _toBeBeforeIndexJs, | ||
'./toBeBoolean/index.js': _toBeBooleanIndexJs, | ||
'./toBeDate/index.js': _toBeDateIndexJs, | ||
'./toBeEmpty/index.js': _toBeEmptyIndexJs, | ||
'./toBeEven/index.js': _toBeEvenIndexJs, | ||
'./toBeExtensible/index.js': _toBeExtensibleIndexJs, | ||
'./toBeFalse/index.js': _toBeFalseIndexJs, | ||
'./toBeFinite/index.js': _toBeFiniteIndexJs, | ||
'./toBeFrozen/index.js': _toBeFrozenIndexJs, | ||
'./toBeFunction/index.js': _toBeFunctionIndexJs, | ||
'./toBeNaN/index.js': _toBeNaNIndexJs, | ||
'./toBeNegative/index.js': _toBeNegativeIndexJs, | ||
'./toBeNil/index.js': _toBeNilIndexJs, | ||
'./toBeNumber/index.js': _toBeNumberIndexJs, | ||
'./toBeObject/index.js': _toBeObjectIndexJs, | ||
'./toBeOdd/index.js': _toBeOddIndexJs, | ||
'./toBeOneOf/index.js': _toBeOneOfIndexJs, | ||
'./toBePositive/index.js': _toBePositiveIndexJs, | ||
'./toBeSealed/index.js': _toBeSealedIndexJs, | ||
'./toBeString/index.js': _toBeStringIndexJs, | ||
'./toBeTrue/index.js': _toBeTrueIndexJs, | ||
'./toBeValidDate/index.js': _toBeValidDateIndexJs, | ||
'./toBeWithin/index.js': _toBeWithinIndexJs, | ||
'./toContainAllEntries/index.js': _toContainAllEntriesIndexJs, | ||
'./toContainAllKeys/index.js': _toContainAllKeysIndexJs, | ||
'./toContainAllValues/index.js': _toContainAllValuesIndexJs, | ||
'./toContainAnyEntries/index.js': _toContainAnyEntriesIndexJs, | ||
'./toContainAnyKeys/index.js': _toContainAnyKeysIndexJs, | ||
'./toContainAnyValues/index.js': _toContainAnyValuesIndexJs, | ||
'./toContainEntries/index.js': _toContainEntriesIndexJs, | ||
'./toContainEntry/index.js': _toContainEntryIndexJs, | ||
'./toContainKey/index.js': _toContainKeyIndexJs, | ||
'./toContainKeys/index.js': _toContainKeysIndexJs, | ||
'./toContainValue/index.js': _toContainValueIndexJs, | ||
'./toContainValues/index.js': _toContainValuesIndexJs, | ||
'./toEndWith/index.js': _toEndWithIndexJs, | ||
'./toEqualCaseInsensitive/index.js': _toEqualCaseInsensitiveIndexJs, | ||
'./toHaveBeenCalledAfter/index.js': _toHaveBeenCalledAfterIndexJs, | ||
'./toHaveBeenCalledBefore/index.js': _toHaveBeenCalledBeforeIndexJs, | ||
'./toInclude/index.js': _toIncludeIndexJs, | ||
'./toIncludeAllMembers/index.js': _toIncludeAllMembersIndexJs, | ||
'./toIncludeAnyMembers/index.js': _toIncludeAnyMembersIndexJs, | ||
'./toIncludeMultiple/index.js': _toIncludeMultipleIndexJs, | ||
'./toIncludeRepeated/index.js': _toIncludeRepeatedIndexJs, | ||
'./toIncludeSameMembers/index.js': _toIncludeSameMembersIndexJs, | ||
'./toSatisfy/index.js': _toSatisfyIndexJs, | ||
'./toSatisfyAll/index.js': _toSatisfyAllIndexJs, | ||
'./toStartWith/index.js': _toStartWithIndexJs | ||
}; | ||
exports.default = Object.values(imports).reduce((acc, matcher) => _extends({}, acc, matcher.default), {}); |
@@ -6,12 +6,11 @@ 'use strict'; | ||
}); | ||
function is(type) { | ||
return value => Object.prototype.toString.call(value) === `[object ${type}]`; | ||
} | ||
let hasDateType = is('Date'); | ||
var _jestGetType = require('jest-get-type'); | ||
function isDate(value) { | ||
return hasDateType(value) && !isNaN(value); | ||
} | ||
var _jestGetType2 = _interopRequireDefault(_jestGetType); | ||
exports.default = expected => isDate(expected); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const isDate = value => (0, _jestGetType2.default)(value) === 'date' && !isNaN(value); | ||
exports.default = isDate; |
@@ -7,2 +7,8 @@ 'use strict'; | ||
exports.default = expected => typeof expected === 'object'; | ||
var _jestGetType = require('jest-get-type'); | ||
var _jestGetType2 = _interopRequireDefault(_jestGetType); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = expected => (0, _jestGetType2.default)(expected) === 'object'; |
@@ -15,17 +15,17 @@ 'use strict'; | ||
const passMessage = (firsTimestamps, secondTimestamps) => () => (0, _jestMatcherUtils.matcherHint)('.not.toHaveBeenCalledBefore') + '\n\n' + 'Expected first mock to not have been called before, timestamps:\n' + ` ${(0, _jestMatcherUtils.printExpected)(firsTimestamps)}\n` + 'Received second mock with timestamps:\n' + ` ${(0, _jestMatcherUtils.printReceived)(secondTimestamps)}`; | ||
const passMessage = (firstInvocationCallOrder, secondInvocationCallOrder) => () => (0, _jestMatcherUtils.matcherHint)('.not.toHaveBeenCalledBefore') + '\n\n' + 'Expected first mock to not have been called before, invocationCallOrder:\n' + ` ${(0, _jestMatcherUtils.printExpected)(firstInvocationCallOrder)}\n` + 'Received second mock with invocationCallOrder:\n' + ` ${(0, _jestMatcherUtils.printReceived)(secondInvocationCallOrder)}`; | ||
const failMessage = (firsTimestamps, secondTimestamps) => () => (0, _jestMatcherUtils.matcherHint)('.toHaveBeenCalledBefore') + '\n\n' + 'Expected first mock to have been called before, timestamps:\n' + ` ${(0, _jestMatcherUtils.printExpected)(firsTimestamps)}\n` + 'Received second mock with timestamps:\n' + ` ${(0, _jestMatcherUtils.printReceived)(secondTimestamps)}`; | ||
const failMessage = (firstInvocationCallOrder, secondInvocationCallOrder) => () => (0, _jestMatcherUtils.matcherHint)('.toHaveBeenCalledBefore') + '\n\n' + 'Expected first mock to have been called before, invocationCallOrder:\n' + ` ${(0, _jestMatcherUtils.printExpected)(firstInvocationCallOrder)}\n` + 'Received second mock with invocationCallOrder:\n' + ` ${(0, _jestMatcherUtils.printReceived)(secondInvocationCallOrder)}`; | ||
exports.default = { | ||
toHaveBeenCalledBefore: (firstMock, secondMock) => { | ||
const firsTimestamps = firstMock.mock.timestamps; | ||
const secondTimestamps = secondMock.mock.timestamps; | ||
const pass = (0, _predicate2.default)(firstMock.mock.timestamps, secondTimestamps); | ||
const firstInvocationCallOrder = firstMock.mock.invocationCallOrder; | ||
const secondInvocationCallOrder = secondMock.mock.invocationCallOrder; | ||
const pass = (0, _predicate2.default)(firstInvocationCallOrder, secondInvocationCallOrder); | ||
if (pass) { | ||
return { pass: true, message: passMessage(firsTimestamps, secondTimestamps) }; | ||
return { pass: true, message: passMessage(firstInvocationCallOrder, secondInvocationCallOrder) }; | ||
} | ||
return { pass: false, message: failMessage(firsTimestamps, secondTimestamps) }; | ||
return { pass: false, message: failMessage(firstInvocationCallOrder, secondInvocationCallOrder) }; | ||
} | ||
}; |
@@ -8,10 +8,10 @@ "use strict"; | ||
exports.default = (firstTimestamps, secondTimestamps) => { | ||
if (firstTimestamps.length === 0) return false; | ||
if (secondTimestamps.length === 0) return true; | ||
exports.default = (firstInvocationCallOrder, secondInvocationCallOrder) => { | ||
if (firstInvocationCallOrder.length === 0) return false; | ||
if (secondInvocationCallOrder.length === 0) return true; | ||
const firstSmallest = smallest(firstTimestamps); | ||
const secondSmallest = smallest(secondTimestamps); | ||
const firstSmallest = smallest(firstInvocationCallOrder); | ||
const secondSmallest = smallest(secondInvocationCallOrder); | ||
return firstSmallest < secondSmallest; | ||
}; |
{ | ||
"name": "jest-extended", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "Additional Jest matchers", | ||
@@ -45,3 +45,3 @@ "main": "dist/index.js", | ||
"babel-eslint": "^8.0.1", | ||
"babel-jest": "^22.1.0", | ||
"babel-jest": "^23.0.1", | ||
"babel-jest-assertions": "^0.1.0", | ||
@@ -57,4 +57,6 @@ "babel-plugin-gwt": "^1.0.0", | ||
"husky": "^0.14.3", | ||
"jest": "^22.1.4", | ||
"import-all.macro": "^2.0.3", | ||
"jest": "^23.0.1", | ||
"jest-each": "^0.5.0", | ||
"jest-watch-typeahead": "^0.2.0", | ||
"lint-staged": "^6.0.0", | ||
@@ -65,4 +67,4 @@ "prettier": "^1.7.4", | ||
"dependencies": { | ||
"chalk": "^2.3.0", | ||
"expect": "^22.1.0", | ||
"jest-get-type": "^22.4.3", | ||
"jest-matcher-utils": "^22.0.0" | ||
@@ -95,3 +97,7 @@ }, | ||
} | ||
} | ||
}, | ||
"watchPlugins": [ | ||
"jest-watch-typeahead/filename", | ||
"jest-watch-typeahead/testname" | ||
] | ||
}, | ||
@@ -104,5 +110,6 @@ "babel": { | ||
"babel-jest-assertions", | ||
"gwt" | ||
"gwt", | ||
"macros" | ||
] | ||
} | ||
} |
210
README.md
@@ -35,64 +35,71 @@ <div align="center"> | ||
- [Problem](#problem) | ||
- [Solution](#solution) | ||
- [Contributing](#contributing) | ||
- [Installation](#installation) | ||
- [Setup](#setup) | ||
- [API](#api) | ||
* [.pass(message)](#passmessage) | ||
* [.fail(message)](#failmessage) | ||
* [.toBeEmpty()](#tobeempty) | ||
* [.toBeOneOf([members])](#tobeoneofmembers) | ||
* [.toBeNil()](#tobenil) | ||
* [.toSatisfy(predicate)](#tosatisfypredicate) | ||
* [Array](#array) | ||
* [.toBeArray()](#tobearray) | ||
* [.toBeArrayOfSize()](#tobearrayofsize) | ||
* [.toIncludeAllMembers([members])](#toincludeallmembersmembers) | ||
* [.toIncludeAnyMembers([members])](#toincludeanymbersmembers) | ||
* [.toSatisfyAll(predicate)](#tosatisfyallpredicate) | ||
* [Boolean](#boolean) | ||
* [.toBeBoolean()](#tobeboolean) | ||
* [.toBeTrue()](#tobetrue) | ||
* [.toBeFalse()](#tobefalse) | ||
* [Date](#date) | ||
* [.toBeDate()](#tobedate) | ||
* Further proposals in [#117](https://github.com/jest-community/jest-extended/issues/117) PRs welcome | ||
* [Function](#function) | ||
* [.toBeFunction()](#tobefunction) | ||
* [Mock](#mock) | ||
* [.toHaveBeenCalledBefore()](#tohavebeencalledbefore) | ||
* [Number](#number) | ||
* [.toBeNumber()](#tobenumber) | ||
* [.toBeNaN()](#tobenan) | ||
* [.toBeFinite()](#tobefinite) | ||
* [.toBePositive()](#tobepositive) | ||
* [.toBeNegative()](#tobenegative) | ||
* [.toBeEven()](#tobeeven) | ||
* [.toBeOdd()](#tobeodd) | ||
* [.toBeWithin(start, end)](#tobewithinstart-end) | ||
* [Object](#object) | ||
* [.toBeObject()](#tobeobject) | ||
* [.toContainKey(key)](#tocontainkeykey) | ||
* [.toContainKeys([keys])](#tocontainkeyskeys) | ||
* [.toContainAllKeys([keys])](#tocontainallkeyskeys) | ||
* [.toContainAnyKeys([keys])](#tocontainanykeyskeys) | ||
* [.toContainValue(value)](#tocontainvaluevalue) | ||
* [.toContainValues([values])](#tocontainvaluesvalues) | ||
* [.toContainAllValues([values])](#tocontainallvaluesvalues) | ||
* [.toContainAnyValues([values])](#tocontainanyvaluesvalues) | ||
* [.toContainEntry([key, value])](#tocontainentrykey-value) | ||
* [.toContainEntries([[key, value]])](#tocontainentrieskey-value) | ||
* [.toContainAllEntries([[key, value]])](#tocontainallentrieskey-value) | ||
* [.toContainAnyEntries([[key, value]])](#tocontainanyentrieskey-value) | ||
* [.toBeExtensible()](#tobeextensible) | ||
* [.toBeFrozen()](#tobefrozen) | ||
* [.toBeSealed()](#tobesealed) | ||
* [~~Promise~~](#promise) | ||
* _No APIs proposed yet_ | ||
* [String](#string) | ||
* [.toBeString()](#tobestring) | ||
* [.toEqualCaseInsensitive(string)](#toequalcaseinsensitivestring) | ||
* [.toStartWith(prefix)](#tostartwithprefix) | ||
* [.toEndWith(suffix)](#toendwithsuffix) | ||
* [.toInclude(substring)](#toincludesubstring) | ||
* [.toIncludeRepeated(substring, times)](#toincluderepeatedsubstring-times) | ||
* [.toIncludeMultiple([substring])](#toincludemultiplesubstring) | ||
- [.pass(message)](#passmessage) | ||
- [.fail(message)](#failmessage) | ||
- [.toBeEmpty()](#tobeempty) | ||
- [.toBeOneOf([members])](#tobeoneofmembers) | ||
- [.toBeNil()](#tobenil) | ||
- [.toSatisfy(predicate)](#tosatisfypredicate) | ||
- [Array](#array) | ||
- [.toBeArray()](#tobearray) | ||
- [.toBeArrayOfSize()](#tobearrayofsize) | ||
- [.toIncludeAllMembers([members])](#toincludeallmembersmembers) | ||
- [.toIncludeAnyMembers([members])](#toincludeanymembersmembers) | ||
- [.toIncludeSameMembers([members])](#toincludesamemembersmembers) | ||
- [.toSatisfyAll(predicate)](#tosatisfyallpredicate) | ||
- [Boolean](#boolean) | ||
- [.toBeBoolean()](#tobeboolean) | ||
- [.toBeTrue()](#tobetrue) | ||
- [.toBeFalse()](#tobefalse) | ||
- [Date](#date) | ||
- [.toBeDate()](#tobedate) | ||
- [.toBeValidDate()](#tobevaliddate) | ||
- [.toBeAfter(date)](#tobeafterdate) | ||
- [.toBeBefore(date)](#tobebeforedate) | ||
- Further proposals in [#117](https://github.com/jest-community/jest-extended/issues/117) PRs welcome | ||
- [Function](#function) | ||
- [.toBeFunction()](#tobefunction) | ||
- [Mock](#mock) | ||
- [.toHaveBeenCalledBefore()](#tohavebeencalledbefore) | ||
- [.toHaveBeenCalledAfter()](#tohavebeencalledafter) | ||
- [Number](#number) | ||
- [.toBeNumber()](#tobenumber) | ||
- [.toBeNaN()](#tobenan) | ||
- [.toBeFinite()](#tobefinite) | ||
- [.toBePositive()](#tobepositive) | ||
- [.toBeNegative()](#tobenegative) | ||
- [.toBeEven()](#tobeeven) | ||
- [.toBeOdd()](#tobeodd) | ||
- [.toBeWithin(start, end)](#tobewithinstart--end) | ||
- [Object](#object) | ||
- [.toBeObject()](#tobeobject) | ||
- [.toContainKey(key)](#tocontainkeykey) | ||
- [.toContainKeys([keys])](#tocontainkeyskeys) | ||
- [.toContainAllKeys([keys])](#tocontainallkeyskeys) | ||
- [.toContainAnyKeys([keys])](#tocontainanykeyskeys) | ||
- [.toContainValue(value)](#tocontainvaluevalue) | ||
- [.toContainValues([values])](#tocontainvaluesvalues) | ||
- [.toContainAllValues([values])](#tocontainallvaluesvalues) | ||
- [.toContainAnyValues([values])](#tocontainanyvaluesvalues) | ||
- [.toContainEntry([key, value])](#tocontainentrykey--value) | ||
- [.toContainEntries([[key, value]])](#tocontainentrieskey--value) | ||
- [.toContainAllEntries([[key, value]])](#tocontainallentrieskey--value) | ||
- [.toContainAnyEntries([[key, value]])](#tocontainanyentrieskey--value) | ||
- [.toBeExtensible()](#tobeextensible) | ||
- [.toBeFrozen()](#tobefrozen) | ||
- [.toBeSealed()](#tobesealed) | ||
- [~~Promise~~](#promise) | ||
- [String](#string) | ||
- [.toBeString()](#tobestring) | ||
- [.toEqualCaseInsensitive(string)](#toequalcaseinsensitivestring) | ||
- [.toStartWith(prefix)](#tostartwithprefix) | ||
- [.toEndWith(suffix)](#toendwithsuffix) | ||
- [.toInclude(substring)](#toincludesubstring) | ||
- [.toIncludeRepeated(substring, times)](#toincluderepeatedsubstring--times) | ||
- [.toIncludeMultiple([substring])](#toincludemultiplesubstring) | ||
- [Contributors](#contributors) | ||
@@ -269,3 +276,14 @@ - [LICENSE](#license) | ||
#### .toIncludeSameMembers([members]) | ||
Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order. | ||
```js | ||
test('passes when arrays match in a different order', () => { | ||
expect([1, 2, 3]).toIncludeSameMembers([3, 1, 2]); | ||
expect([{ foo: 'bar' }, { baz: 'qux' }]).toIncludeSameMembers([{ baz: 'qux' }, { foo: 'bar' }]); | ||
}); | ||
``` | ||
#### .toSatisfyAll(predicate) | ||
@@ -337,2 +355,33 @@ | ||
### .toBeValidDate() | ||
Use `.toBeValidDate` when checking if a given `Date` object is valid. | ||
``` | ||
test('passes when Date is valid', () => { | ||
expect(new Date()).toBeValidDate(); | ||
expect('01/01/2018').not.toBeValidDate(); | ||
expect(new Date('01/01/2018').toBeValidDate(); | ||
expect(new Date('01/90/2018').not.toBeValidDate(); | ||
expect(undefined).not.toBeValidDate(); | ||
}); | ||
``` | ||
### .toBeAfter(date) | ||
Use `.toBeAfter` when checking if a date occurs after `date`. | ||
```js | ||
test('passes when input is after date', () => { | ||
expect(new Date('01/01/2019')).toBeAfter(new Date('01/01/2018')); | ||
expect('01/01/2018').not.toBeAfter(new Date('01/01/2019')); | ||
}); | ||
``` | ||
### .toBeBefore(date) | ||
Use `.toBeBefore` when checking if a date occurs before `date`. | ||
```js | ||
test('passes when input is before date', () => { | ||
expect(new Date('01/01/2018')).toBeBefore(new Date('01/01/2019')); | ||
expect('01/01/2019').not.toBeBefore(new Date('01/01/2018')); | ||
}); | ||
``` | ||
### Function | ||
@@ -360,17 +409,14 @@ | ||
_Note: Required Jest version >22_ | ||
_Note: Required Jest version >=23_ | ||
_Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a different | ||
JS event loop, otherwise the mock timestamps will all be the same_ | ||
```js | ||
const timeout = time => () => new Promise(res => setTimeout(() => res()), time); | ||
it('calls mock1 before mock2', async () => { | ||
const mock1 = jest.fn(timeout(1)); | ||
const mock2 = jest.fn(timeout(1)); | ||
it('calls mock1 before mock2', () => { | ||
const mock1 = jest.fn(); | ||
const mock2 = jest.fn(); | ||
await mock1(); | ||
await mock2(); | ||
await mock1(); | ||
mock1(); | ||
mock2(); | ||
mock1(); | ||
@@ -381,2 +427,23 @@ expect(mock1).toHaveBeenCalledBefore(mock2); | ||
#### .toHaveBeenCalledAfter() | ||
Use `.toHaveBeenCalledAfter` when checking if a `Mock` was called after another `Mock`. | ||
_Note: Required Jest version >=23_ | ||
```js | ||
it('calls mock1 after mock2', () => { | ||
const mock1 = jest.fn(); | ||
const mock2 = jest.fn(); | ||
mock2(); | ||
mock1(); | ||
mock2(); | ||
expect(mock1).toHaveBeenCalledAfter(mock2); | ||
}); | ||
``` | ||
### Number | ||
@@ -787,4 +854,5 @@ | ||
| [<img src="https://avatars2.githubusercontent.com/u/33098064?v=4" width="100px;"/><br /><sub>mjmiles</sub>](https://github.com/mjmiles)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=mjmiles "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=mjmiles "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/13333582?v=4" width="100px;"/><br /><sub>Gary Meehan</sub>](https://github.com/garmeeh)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=garmeeh "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=garmeeh "Documentation") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=garmeeh "Tests") | [<img src="https://avatars2.githubusercontent.com/u/3191489?v=4" width="100px;"/><br /><sub>Fredrik MΓ€kilΓ€</sub>](https://github.com/GitHug)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=GitHug "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=GitHug "Tests") | [<img src="https://avatars2.githubusercontent.com/u/9046616?v=4" width="100px;"/><br /><sub>Daniel Reinoso</sub>](http://kloc.io/)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=danielr18 "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=danielr18 "Tests") | [<img src="https://avatars1.githubusercontent.com/u/4359781?v=4" width="100px;"/><br /><sub>Chris Hut</sub>](https://github.com/tophernuts)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=tophernuts "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=tophernuts "Tests") | [<img src="https://avatars2.githubusercontent.com/u/1513183?v=4" width="100px;"/><br /><sub>Kelvin Ly</sub>](https://github.com/cactorium)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=cactorium "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=cactorium "Tests") | [<img src="https://avatars0.githubusercontent.com/u/11182826?v=4" width="100px;"/><br /><sub>Francis Ngo</sub>](https://github.com/francisngo)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=francisngo "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=francisngo "Tests") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/10330923?v=4" width="100px;"/><br /><sub>Amish Shah</sub>](https://hydrabolt.me/)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=hydrabolt "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=hydrabolt "Tests") | [<img src="https://avatars3.githubusercontent.com/u/2045206?v=4" width="100px;"/><br /><sub>Dave Cooper</sub>](http://davecooper.org)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=grug "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=grug "Tests") | [<img src="https://avatars3.githubusercontent.com/u/3630495?v=4" width="100px;"/><br /><sub>Swann Polydor</sub>](https://github.com/soueuls)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=soueuls "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=soueuls "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2027003?v=4" width="100px;"/><br /><sub>vikneshwar</sub>](https://github.com/vikneshwar)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=vikneshwar "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=vikneshwar "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1243921?v=4" width="100px;"/><br /><sub>Budi Irawan</sub>](http://budiirawan.com)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=deerawan "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=deerawan "Tests") | [<img src="https://avatars2.githubusercontent.com/u/980783?v=4" width="100px;"/><br /><sub>Tejas Bubane</sub>](http://foss-geek.blogspot.com/)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=tejasbubane "Code") | [<img src="https://avatars2.githubusercontent.com/u/13134653?v=4" width="100px;"/><br /><sub>Subinoy Ghosh</sub>](https://github.com/subinoy7)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=subinoy7 "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=subinoy7 "Tests") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/1404810?v=4" width="100px;"/><br /><sub>Simen Bekkhus</sub>](https://github.com/SimenB)<br />[π](https://github.com/mattphillips/jest-extended/commits?author=SimenB "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/49038?v=4" width="100px;"/><br /><sub>Orta</sub>](http://orta.io)<br />[π](https://github.com/mattphillips/jest-extended/commits?author=orta "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/17221813?v=4" width="100px;"/><br /><sub>Tom</sub>](https://jsdevtom.com)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Documentation") [π‘](#example-jsdevtom "Examples") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Tests") | [<img src="https://avatars0.githubusercontent.com/u/15064535?v=4" width="100px;"/><br /><sub>Lucian Buzzo</sub>](https://github.com/LucianBuzzo)<br /> | [<img src="https://avatars3.githubusercontent.com/u/2997844?v=4" width="100px;"/><br /><sub>Thiago Delgado Pinto</sub>](https://github.com/thiagodp)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Documentation") [π‘](#example-thiagodp "Examples") [π€](#ideas-thiagodp "Ideas, Planning, & Feedback") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Tests") | [<img src="https://avatars0.githubusercontent.com/u/3042904?v=4" width="100px;"/><br /><sub>Ragnar Laud</sub>](https://github.com/xprn)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=xprn "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=xprn "Documentation") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/10330923?v=4" width="100px;"/><br /><sub>Amish Shah</sub>](https://hydrabolt.me/)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=hydrabolt "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=hydrabolt "Tests") | [<img src="https://avatars3.githubusercontent.com/u/2045206?v=4" width="100px;"/><br /><sub>Dave Cooper</sub>](http://davecooper.org)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=grug "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=grug "Tests") | [<img src="https://avatars3.githubusercontent.com/u/3630495?v=4" width="100px;"/><br /><sub>Swann Polydor</sub>](https://github.com/soueuls)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=soueuls "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=soueuls "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2027003?v=4" width="100px;"/><br /><sub>vikneshwar</sub>](https://github.com/vikneshwar)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=vikneshwar "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=vikneshwar "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1243921?v=4" width="100px;"/><br /><sub>Budi Irawan</sub>](http://budiirawan.com)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=deerawan "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=deerawan "Tests") | [<img src="https://avatars2.githubusercontent.com/u/980783?v=4" width="100px;"/><br /><sub>Tejas Bubane</sub>](http://foss-geek.blogspot.com/)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=tejasbubane "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=tejasbubane "Tests") [π](https://github.com/mattphillips/jest-extended/commits?author=tejasbubane "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/13134653?v=4" width="100px;"/><br /><sub>Subinoy Ghosh</sub>](https://github.com/subinoy7)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=subinoy7 "Code") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=subinoy7 "Tests") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/1404810?v=4" width="100px;"/><br /><sub>Simen Bekkhus</sub>](https://github.com/SimenB)<br />[π](https://github.com/mattphillips/jest-extended/commits?author=SimenB "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/49038?v=4" width="100px;"/><br /><sub>Orta</sub>](http://orta.io)<br />[π](https://github.com/mattphillips/jest-extended/commits?author=orta "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/17221813?v=4" width="100px;"/><br /><sub>Tom</sub>](https://jsdevtom.com)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Documentation") [π‘](#example-jsdevtom "Examples") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=jsdevtom "Tests") | [<img src="https://avatars0.githubusercontent.com/u/15064535?v=4" width="100px;"/><br /><sub>Lucian Buzzo</sub>](https://github.com/LucianBuzzo)<br /> | [<img src="https://avatars3.githubusercontent.com/u/2997844?v=4" width="100px;"/><br /><sub>Thiago Delgado Pinto</sub>](https://github.com/thiagodp)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Documentation") [π‘](#example-thiagodp "Examples") [π€](#ideas-thiagodp "Ideas, Planning, & Feedback") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=thiagodp "Tests") | [<img src="https://avatars0.githubusercontent.com/u/3042904?v=4" width="100px;"/><br /><sub>Ragnar Laud</sub>](https://github.com/xprn)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=xprn "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=xprn "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/3047126?v=4" width="100px;"/><br /><sub>Luiz AmΓ©rico</sub>](https://github.com/blikblum)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=blikblum "Code") | | ||
| [<img src="https://avatars0.githubusercontent.com/u/615334?v=4" width="100px;"/><br /><sub>Frederick Fogerty</sub>](https://github.com/frederickfogerty)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=frederickfogerty "Code") [π€](#ideas-frederickfogerty "Ideas, Planning, & Feedback") | [<img src="https://avatars1.githubusercontent.com/u/10714808?v=4" width="100px;"/><br /><sub>Benjamin Kay</sub>](https://github.com/benjaminkay93)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=benjaminkay93 "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=benjaminkay93 "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/868844?v=4" width="100px;"/><br /><sub>Gilles De Mey</sub>](https://demey.io)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=gillesdemey "Code") [π](https://github.com/mattphillips/jest-extended/commits?author=gillesdemey "Documentation") [β οΈ](https://github.com/mattphillips/jest-extended/commits?author=gillesdemey "Tests") | [<img src="https://avatars0.githubusercontent.com/u/50928?v=4" width="100px;"/><br /><sub>Deniz Dogan</sub>](https://github.com/denizdogan)<br />[π»](https://github.com/mattphillips/jest-extended/commits?author=denizdogan "Code") | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -791,0 +859,0 @@ |
@@ -56,2 +56,14 @@ /// <reference types="jest" /> | ||
/** | ||
* Use `.toBeAfter` when checking if a date occurs after `date`. | ||
* @param {Date} date | ||
*/ | ||
toBeAfter(date: Date): R; | ||
/** | ||
* Use `.toBeBefore` when checking if a date occurs before `date`. | ||
* @param {Date} date | ||
*/ | ||
toBeBefore(date: Date): R; | ||
/** | ||
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. | ||
@@ -69,2 +81,8 @@ * @param {Array.<*>} members | ||
/** | ||
* Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order. | ||
* @param {Array.<*>} members | ||
*/ | ||
toIncludeSameMembers(members: any[]): R; | ||
/** | ||
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. | ||
@@ -91,3 +109,3 @@ * @param {Function} predicate | ||
/** | ||
* Use .toBeDate when checking if a value is a Date. | ||
* Use `.toBeDate` when checking if a value is a `Date`. | ||
*/ | ||
@@ -97,2 +115,7 @@ toBeDate(): R; | ||
/** | ||
* Use `.toBeValidDate` when checking if a value is a `valid Date`. | ||
*/ | ||
toBeValidDate(): R; | ||
/** | ||
* Use `.toBeFunction` when checking if a value is a `Function`. | ||
@@ -105,4 +128,3 @@ */ | ||
* | ||
* Note: Required Jest version >22 | ||
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same | ||
* Note: Required Jest version >=23 | ||
* | ||
@@ -114,2 +136,11 @@ * @param {Mock} mock | ||
/** | ||
* Use `.toHaveBeenCalledAfter` when checking if a `Mock` was called after another `Mock`. | ||
* | ||
* Note: Required Jest version >=23 | ||
* | ||
* @param {Mock} mock | ||
*/ | ||
toHaveBeenCalledAfter(mock: jest.Mock): R; | ||
/** | ||
* Use `.toBeNumber` when checking if a value is a `Number`. | ||
@@ -310,2 +341,1 @@ */ | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129770
108
1751
857
23
+ Addedjest-get-type@^22.4.3
- Removedchalk@^2.3.0