jest-extended
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -372,2 +372,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "toPartiallyContain", { | ||
enumerable: true, | ||
get: function () { | ||
return _toPartiallyContain.toPartiallyContain; | ||
} | ||
}); | ||
Object.defineProperty(exports, "toReject", { | ||
@@ -550,2 +556,4 @@ enumerable: true, | ||
var _toEqualIgnoringWhitespace = require("./toEqualIgnoringWhitespace"); | ||
var _toEqualIgnoringWhitespace = require("./toEqualIgnoringWhitespace"); | ||
var _toPartiallyContain = require("./toPartiallyContain"); |
@@ -8,4 +8,6 @@ "use strict"; | ||
var _utils = require("../../utils"); | ||
var _predicate = _interopRequireDefault(require("../toContainEntries/predicate")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = (obj, entries) => { | ||
@@ -16,5 +18,5 @@ if (!obj.hasOwnProperty || entries.length != Object.keys(obj).length) { | ||
return entries.every(([key, value]) => Object.prototype.hasOwnProperty.call(obj, key) && (0, _utils.equals)(obj[key], value)); | ||
return (0, _predicate.default)(obj, entries); | ||
}; | ||
exports.default = _default; |
@@ -8,6 +8,8 @@ "use strict"; | ||
var _utils = require("../../utils"); | ||
var _predicate = _interopRequireDefault(require("../toContainEntry/predicate")); | ||
var _default = (obj, entries) => entries.every(([key, value]) => Object.prototype.hasOwnProperty.call(obj, key) && (0, _utils.equals)(obj[key], value)); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = (obj, entries) => entries.every(entry => (0, _predicate.default)(obj, entry)); | ||
exports.default = _default; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _predicate = _interopRequireDefault(require("../toContainAnyEntries/predicate")); | ||
var _predicate = _interopRequireDefault(require("../toContainEntries/predicate")); | ||
@@ -11,0 +11,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
{ | ||
"name": "jest-extended", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Additional Jest matchers", | ||
@@ -51,3 +51,3 @@ "main": "dist/index.js", | ||
"jest-watch-typeahead": "^1.0.0", | ||
"lint-staged": "^11.0.0", | ||
"lint-staged": "^12.0.0", | ||
"prettier": "^2.3.2", | ||
@@ -54,0 +54,0 @@ "pretty-format": "^27.2.4", |
@@ -56,2 +56,3 @@ <div align="center"> | ||
- [.toIncludeSameMembers([members])](#toincludesamemembersmembers) | ||
- [.toPartiallyContain(member)](#topartiallycontain) | ||
- [.toSatisfyAll(predicate)](#tosatisfyallpredicate) | ||
@@ -356,2 +357,14 @@ - [.toSatisfyAny(predicate)](#tosatisfyanypredicate) | ||
#### .toPartiallyContain(member) | ||
Use `.toPartiallyContain` when checking if any array value matches the partial member. | ||
```js | ||
test('passes when a string has a given substring', () => { | ||
expect([{ foo: 'bar', baz: 'qux', bax: 'zax' }]).toPartiallyContain({ foo: 'bar' }); | ||
expect([{ foo: 'bar', baz: 'qux', bax: 'zax' }]).toPartiallyContain({ baz: 'qux' }); | ||
expect([{ foo: 'bar', baz: 'qux', bax: 'zax' }]).not.toPartiallyContain({ foo: 'qux' }); | ||
}); | ||
``` | ||
#### .toSatisfyAll(predicate) | ||
@@ -358,0 +371,0 @@ |
@@ -134,14 +134,10 @@ /// <reference types="jest" /> | ||
/** | ||
* Use `.toBeDateString` when checking if a value is a valid date string. | ||
* | ||
* @param {String} string | ||
*/ | ||
toBeDateString(string: string): R; | ||
* Use `.toBeDateString` when checking if a value is a valid date string. | ||
*/ | ||
toBeDateString(): R; | ||
/** | ||
* Use `.toBeHexadecimal` when checking if a value is a valid HTML hex color. | ||
* | ||
* @param {String} string | ||
*/ | ||
toBeHexadecimal(string: string): R; | ||
toBeHexadecimal(): R; | ||
@@ -418,3 +414,3 @@ /** | ||
*/ | ||
toEqualIgnoringWhitespace(string: string): R; | ||
toEqualIgnoringWhitespace(string: string): R; | ||
} | ||
@@ -546,14 +542,10 @@ | ||
/** | ||
* Use `.toBeDateString` when checking if a value is a valid date string. | ||
* | ||
* @param {String} string | ||
*/ | ||
toBeDateString(string: string): any; | ||
* Use `.toBeDateString` when checking if a value is a valid date string. | ||
*/ | ||
toBeDateString(): any; | ||
/** | ||
* Use `.toBeHexadecimal` when checking if a value is a valid HTML hex color. | ||
* | ||
* @param {String} string | ||
*/ | ||
toBeHexadecimal(string: string): any; | ||
toBeHexadecimal(): any; | ||
@@ -830,4 +822,4 @@ /** | ||
*/ | ||
toEqualIgnoringWhitespace(string: string): any; | ||
toEqualIgnoringWhitespace(string: string): any; | ||
} | ||
} |
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
183547
148
3492
1143