Comparing version 1.12.2 to 1.13.0
@@ -0,1 +1,13 @@ | ||
## HEAD | ||
- Better error messages in `toThrow`/`toNotThrow` | ||
## [v1.12.2] | ||
> Oct 13, 2015 | ||
- Fix postinstall script on Windows (see [#39]) | ||
[v1.12.2]: https://github.com/mjackson/expect/compare/v1.12.1...v1.12.2 | ||
[#39]: https://github.com/mjackson/expect/issues/39 | ||
## [v1.12.1] | ||
@@ -2,0 +14,0 @@ > Oct 10, 2015 |
@@ -21,26 +21,6 @@ 'use strict'; | ||
var _isFunction = require('./isFunction'); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
var _functionThrows = require('./functionThrows'); | ||
var _functionThrows2 = _interopRequireDefault(_functionThrows); | ||
var _stringContains = require('./stringContains'); | ||
var _stringContains2 = _interopRequireDefault(_stringContains); | ||
var _arrayContains = require('./arrayContains'); | ||
var _arrayContains2 = _interopRequireDefault(_arrayContains); | ||
var _SpyUtils = require('./SpyUtils'); | ||
var _isA = require('./isA'); | ||
var _TestUtils = require('./TestUtils'); | ||
var _isA2 = _interopRequireDefault(_isA); | ||
var isArray = Array.isArray; | ||
/** | ||
@@ -58,3 +38,3 @@ * An Expectation is a wrapper around an assertion that allows it to be written | ||
if (_isFunction2['default'](actual)) { | ||
if (_TestUtils.isFunction(actual)) { | ||
this.context = null; | ||
@@ -110,5 +90,5 @@ this.args = []; | ||
Expectation.prototype.toThrow = function toThrow(value, message) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value); | ||
_assert2['default'](_TestUtils.functionThrows(this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value || 'an error'); | ||
@@ -119,5 +99,5 @@ return this; | ||
Expectation.prototype.toNotThrow = function toNotThrow(value, message) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](!_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value); | ||
_assert2['default'](!_TestUtils.functionThrows(this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value || 'an error'); | ||
@@ -128,5 +108,5 @@ return this; | ||
Expectation.prototype.toBeA = function toBeA(value, message) { | ||
_assert2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); | ||
_assert2['default'](_TestUtils.isFunction(value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); | ||
_assert2['default'](_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
_assert2['default'](_TestUtils.isA(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
@@ -137,5 +117,5 @@ return this; | ||
Expectation.prototype.toNotBeA = function toNotBeA(value, message) { | ||
_assert2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); | ||
_assert2['default'](_TestUtils.isFunction(value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); | ||
_assert2['default'](!_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
_assert2['default'](!_TestUtils.isA(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
@@ -186,3 +166,3 @@ return this; | ||
Expectation.prototype.toInclude = function toInclude(value, comparator, message) { | ||
_assert2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toInclude() must be an array or a string'); | ||
_assert2['default'](_TestUtils.isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toInclude() must be an array or a string'); | ||
@@ -196,6 +176,6 @@ if (typeof comparator === 'string') { | ||
if (isArray(this.actual)) { | ||
_assert2['default'](_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value); | ||
if (_TestUtils.isArray(this.actual)) { | ||
_assert2['default'](_TestUtils.arrayContains(this.actual, value, comparator), message, this.actual, value); | ||
} else { | ||
_assert2['default'](_stringContains2['default'](this.actual, value), message, this.actual, value); | ||
_assert2['default'](_TestUtils.stringContains(this.actual, value), message, this.actual, value); | ||
} | ||
@@ -207,3 +187,3 @@ | ||
Expectation.prototype.toExclude = function toExclude(value, comparator, message) { | ||
_assert2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toExclude() must be an array or a string'); | ||
_assert2['default'](_TestUtils.isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toExclude() must be an array or a string'); | ||
@@ -217,6 +197,6 @@ if (typeof comparator === 'string') { | ||
if (isArray(this.actual)) { | ||
_assert2['default'](!_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value); | ||
if (_TestUtils.isArray(this.actual)) { | ||
_assert2['default'](!_TestUtils.arrayContains(this.actual, value, comparator), message, this.actual, value); | ||
} else { | ||
_assert2['default'](!_stringContains2['default'](this.actual, value), message, this.actual, value); | ||
_assert2['default'](!_TestUtils.stringContains(this.actual, value), message, this.actual, value); | ||
} | ||
@@ -262,3 +242,3 @@ | ||
Expectation.prototype.withContext = function withContext(context) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); | ||
@@ -271,3 +251,3 @@ this.context = context; | ||
Expectation.prototype.withArgs = function withArgs() { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); | ||
@@ -274,0 +254,0 @@ if (arguments.length) this.args = this.args.concat(Array.prototype.slice.call(arguments, 0)); |
@@ -15,6 +15,4 @@ 'use strict'; | ||
var _isFunction = require('./isFunction'); | ||
var _TestUtils = require('./TestUtils'); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
function noop() {} | ||
@@ -29,3 +27,3 @@ | ||
_assert2['default'](_isFunction2['default'](fn), 'createSpy needs a function'); | ||
_assert2['default'](_TestUtils.isFunction(fn), 'createSpy needs a function'); | ||
@@ -87,3 +85,3 @@ var targetFn = undefined, | ||
if (!isSpy(original)) { | ||
_assert2['default'](_isFunction2['default'](original), 'Cannot spyOn the %s property; it is not a function', methodName); | ||
_assert2['default'](_TestUtils.isFunction(original), 'Cannot spyOn the %s property; it is not a function', methodName); | ||
@@ -90,0 +88,0 @@ object[methodName] = createSpy(original, function () { |
import deepEqual from 'deep-equal' | ||
import isRegExp from 'is-regexp' | ||
import assert from './assert' | ||
import isFunction from './isFunction' | ||
import functionThrows from './functionThrows' | ||
import stringContains from './stringContains' | ||
import arrayContains from './arrayContains' | ||
import { isSpy } from './SpyUtils' | ||
import isA from './isA' | ||
import { functionThrows, arrayContains, stringContains, isArray, isFunction, isA } from './TestUtils' | ||
const isArray = Array.isArray | ||
/** | ||
@@ -112,3 +106,3 @@ * An Expectation is a wrapper around an assertion that allows it to be written | ||
this.actual, | ||
value | ||
value || 'an error' | ||
) | ||
@@ -130,3 +124,3 @@ | ||
this.actual, | ||
value | ||
value || 'an error' | ||
) | ||
@@ -133,0 +127,0 @@ |
import assert from './assert' | ||
import isFunction from './isFunction' | ||
import { isFunction } from './TestUtils' | ||
@@ -4,0 +4,0 @@ function noop() {} |
{ | ||
"name": "expect", | ||
"version": "1.12.2", | ||
"version": "1.13.0", | ||
"description": "Write better assertions", | ||
@@ -19,4 +19,6 @@ "main": "lib/index", | ||
"karma": "^0.13.3", | ||
"karma-browserstack-launcher": "^0.1.6", | ||
"karma-chrome-launcher": "^0.2.0", | ||
"karma-mocha": "^0.2.0", | ||
"karma-mocha-reporter": "^1.0.4", | ||
"karma-sourcemap-loader": "^0.3.5", | ||
@@ -33,4 +35,3 @@ "karma-webpack": "^1.7.0", | ||
"lint": "eslint modules", | ||
"test": "npm run lint && mocha --compilers js:babel/register --reporter spec 'modules/**/__tests__/*-test.js'", | ||
"test-browser": "npm run lint && karma start", | ||
"test": "npm run lint && karma start", | ||
"postinstall": "node ./npm-scripts/postinstall.js" | ||
@@ -37,0 +38,0 @@ }, |
@@ -29,8 +29,10 @@ # expect | ||
There is a UMD build in the npm package in the `umd` directory. Use it like: | ||
The UMD build is also available on [npmcdn](https://npmcdn.com): | ||
```js | ||
var expect = require('expect/umd/expect.min') | ||
```html | ||
<script src="https://npmcdn.com/expect/umd/expect.min.js"></script> | ||
``` | ||
You can find the library on `window.expect`. | ||
## Assertions | ||
@@ -408,16 +410,8 @@ | ||
## Extensions | ||
- [expect-jsx](https://github.com/algolia/expect-jsx) Add things like `expect(ReactComponent).toEqualJSX(<TestComponent prop="yes" />)` | ||
## Issues | ||
Please file issues on the [issue tracker on GitHub](https://github.com/mjackson/expect/issues). | ||
## Tests | ||
To run the tests in node: | ||
$ npm install | ||
$ npm test | ||
To run the tests in Chrome: | ||
$ npm install | ||
$ npm run test-browser |
@@ -67,3 +67,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _SpyUtils = __webpack_require__(12); | ||
var _SpyUtils = __webpack_require__(8); | ||
@@ -74,3 +74,3 @@ var _assert = __webpack_require__(6); | ||
var _extend = __webpack_require__(14); | ||
var _extend = __webpack_require__(10); | ||
@@ -117,26 +117,6 @@ var _extend2 = _interopRequireDefault(_extend); | ||
var _isFunction = __webpack_require__(8); | ||
var _SpyUtils = __webpack_require__(8); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
var _TestUtils = __webpack_require__(9); | ||
var _functionThrows = __webpack_require__(9); | ||
var _functionThrows2 = _interopRequireDefault(_functionThrows); | ||
var _stringContains = __webpack_require__(10); | ||
var _stringContains2 = _interopRequireDefault(_stringContains); | ||
var _arrayContains = __webpack_require__(11); | ||
var _arrayContains2 = _interopRequireDefault(_arrayContains); | ||
var _SpyUtils = __webpack_require__(12); | ||
var _isA = __webpack_require__(13); | ||
var _isA2 = _interopRequireDefault(_isA); | ||
var isArray = Array.isArray; | ||
/** | ||
@@ -154,3 +134,3 @@ * An Expectation is a wrapper around an assertion that allows it to be written | ||
if (_isFunction2['default'](actual)) { | ||
if (_TestUtils.isFunction(actual)) { | ||
this.context = null; | ||
@@ -206,5 +186,5 @@ this.args = []; | ||
Expectation.prototype.toThrow = function toThrow(value, message) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value); | ||
_assert2['default'](_TestUtils.functionThrows(this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value || 'an error'); | ||
@@ -215,5 +195,5 @@ return this; | ||
Expectation.prototype.toNotThrow = function toNotThrow(value, message) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); | ||
_assert2['default'](!_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value); | ||
_assert2['default'](!_TestUtils.functionThrows(this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value || 'an error'); | ||
@@ -224,5 +204,5 @@ return this; | ||
Expectation.prototype.toBeA = function toBeA(value, message) { | ||
_assert2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); | ||
_assert2['default'](_TestUtils.isFunction(value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); | ||
_assert2['default'](_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
_assert2['default'](_TestUtils.isA(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
@@ -233,5 +213,5 @@ return this; | ||
Expectation.prototype.toNotBeA = function toNotBeA(value, message) { | ||
_assert2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); | ||
_assert2['default'](_TestUtils.isFunction(value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); | ||
_assert2['default'](!_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
_assert2['default'](!_TestUtils.isA(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); | ||
@@ -282,3 +262,3 @@ return this; | ||
Expectation.prototype.toInclude = function toInclude(value, comparator, message) { | ||
_assert2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toInclude() must be an array or a string'); | ||
_assert2['default'](_TestUtils.isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toInclude() must be an array or a string'); | ||
@@ -292,6 +272,6 @@ if (typeof comparator === 'string') { | ||
if (isArray(this.actual)) { | ||
_assert2['default'](_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value); | ||
if (_TestUtils.isArray(this.actual)) { | ||
_assert2['default'](_TestUtils.arrayContains(this.actual, value, comparator), message, this.actual, value); | ||
} else { | ||
_assert2['default'](_stringContains2['default'](this.actual, value), message, this.actual, value); | ||
_assert2['default'](_TestUtils.stringContains(this.actual, value), message, this.actual, value); | ||
} | ||
@@ -303,3 +283,3 @@ | ||
Expectation.prototype.toExclude = function toExclude(value, comparator, message) { | ||
_assert2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toExclude() must be an array or a string'); | ||
_assert2['default'](_TestUtils.isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toExclude() must be an array or a string'); | ||
@@ -313,6 +293,6 @@ if (typeof comparator === 'string') { | ||
if (isArray(this.actual)) { | ||
_assert2['default'](!_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value); | ||
if (_TestUtils.isArray(this.actual)) { | ||
_assert2['default'](!_TestUtils.arrayContains(this.actual, value, comparator), message, this.actual, value); | ||
} else { | ||
_assert2['default'](!_stringContains2['default'](this.actual, value), message, this.actual, value); | ||
_assert2['default'](!_TestUtils.stringContains(this.actual, value), message, this.actual, value); | ||
} | ||
@@ -358,3 +338,3 @@ | ||
Expectation.prototype.withContext = function withContext(context) { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); | ||
@@ -367,3 +347,3 @@ this.context = context; | ||
Expectation.prototype.withArgs = function withArgs() { | ||
_assert2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); | ||
_assert2['default'](_TestUtils.isFunction(this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); | ||
@@ -731,19 +711,2 @@ if (arguments.length) this.args = this.args.concat(Array.prototype.slice.call(arguments, 0)); | ||
/* 8 */ | ||
/***/ function(module, exports) { | ||
/** | ||
* Returns true if the given object is a function. | ||
*/ | ||
'use strict'; | ||
exports.__esModule = true; | ||
function isFunction(object) { | ||
return typeof object === 'function'; | ||
} | ||
exports['default'] = isFunction; | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -754,92 +717,2 @@ | ||
exports.__esModule = true; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _isRegexp = __webpack_require__(5); | ||
var _isRegexp2 = _interopRequireDefault(_isRegexp); | ||
var _isFunction = __webpack_require__(8); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
/** | ||
* Returns true if the given function throws the given value | ||
* when invoked. The value may be: | ||
* | ||
* - undefined, to merely assert there was a throw | ||
* - a constructor function, for comparing using instanceof | ||
* - a regular expression, to compare with the error message | ||
* - a string, to find in the error message | ||
*/ | ||
function functionThrows(fn, context, args, value) { | ||
try { | ||
fn.apply(context, args); | ||
} catch (error) { | ||
if (value == null) return true; | ||
if (_isFunction2['default'](value) && error instanceof value) return true; | ||
var message = error.message || error; | ||
if (typeof message === 'string') { | ||
if (_isRegexp2['default'](value) && value.test(error.message)) return true; | ||
if (typeof value === 'string' && message.indexOf(value) !== -1) return true; | ||
} | ||
} | ||
return false; | ||
} | ||
exports['default'] = functionThrows; | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 10 */ | ||
/***/ function(module, exports) { | ||
/** | ||
* Returns true if the given string contains the value, false otherwise. | ||
*/ | ||
"use strict"; | ||
exports.__esModule = true; | ||
function stringContains(string, value) { | ||
return string.indexOf(value) !== -1; | ||
} | ||
exports["default"] = stringContains; | ||
module.exports = exports["default"]; | ||
/***/ }, | ||
/* 11 */ | ||
/***/ function(module, exports) { | ||
/** | ||
* Returns true if the given array contains the value, false | ||
* otherwise. The comparator function must return false to | ||
* indicate a non-match. | ||
*/ | ||
"use strict"; | ||
exports.__esModule = true; | ||
function arrayContains(array, value, comparator) { | ||
if (comparator == null) return array.indexOf(value) !== -1; | ||
return array.some(function (item) { | ||
return comparator(item, value) !== false; | ||
}); | ||
} | ||
exports["default"] = arrayContains; | ||
module.exports = exports["default"]; | ||
/***/ }, | ||
/* 12 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports.createSpy = createSpy; | ||
@@ -856,6 +729,4 @@ exports.spyOn = spyOn; | ||
var _isFunction = __webpack_require__(8); | ||
var _TestUtils = __webpack_require__(9); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
function noop() {} | ||
@@ -870,3 +741,3 @@ | ||
_assert2['default'](_isFunction2['default'](fn), 'createSpy needs a function'); | ||
_assert2['default'](_TestUtils.isFunction(fn), 'createSpy needs a function'); | ||
@@ -928,3 +799,3 @@ var targetFn = undefined, | ||
if (!isSpy(original)) { | ||
_assert2['default'](_isFunction2['default'](original), 'Cannot spyOn the %s property; it is not a function', methodName); | ||
_assert2['default'](_TestUtils.isFunction(original), 'Cannot spyOn the %s property; it is not a function', methodName); | ||
@@ -950,3 +821,3 @@ object[methodName] = createSpy(original, function () { | ||
/***/ }, | ||
/* 13 */ | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -957,15 +828,94 @@ | ||
exports.__esModule = true; | ||
exports.functionThrows = functionThrows; | ||
exports.arrayContains = arrayContains; | ||
exports.stringContains = stringContains; | ||
exports.isArray = isArray; | ||
exports.isFunction = isFunction; | ||
exports.isA = isA; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _isFunction = __webpack_require__(8); | ||
var _deepEqual = __webpack_require__(2); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
var _deepEqual2 = _interopRequireDefault(_deepEqual); | ||
var _isRegexp = __webpack_require__(5); | ||
var _isRegexp2 = _interopRequireDefault(_isRegexp); | ||
/** | ||
* Returns true if the given function throws the given value | ||
* when invoked. The value may be: | ||
* | ||
* - undefined, to merely assert there was a throw | ||
* - a constructor function, for comparing using instanceof | ||
* - a regular expression, to compare with the error message | ||
* - a string, to find in the error message | ||
*/ | ||
function functionThrows(fn, context, args, value) { | ||
try { | ||
fn.apply(context, args); | ||
} catch (error) { | ||
if (value == null) return true; | ||
if (isFunction(value) && error instanceof value) return true; | ||
var message = error.message || error; | ||
if (typeof message === 'string') { | ||
if (_isRegexp2['default'](value) && value.test(error.message)) return true; | ||
if (typeof value === 'string' && message.indexOf(value) !== -1) return true; | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Returns true if the given array contains the value, false | ||
* otherwise. The comparator function must return false to | ||
* indicate a non-match. | ||
*/ | ||
function arrayContains(array, value, comparator) { | ||
if (comparator == null) comparator = _deepEqual2['default']; | ||
return array.some(function (item) { | ||
return comparator(item, value) !== false; | ||
}); | ||
} | ||
/** | ||
* Returns true if the given string contains the value, false otherwise. | ||
*/ | ||
function stringContains(string, value) { | ||
return string.indexOf(value) !== -1; | ||
} | ||
/** | ||
* Returns true if the given object is an array. | ||
*/ | ||
function isArray(object) { | ||
return Array.isArray(object); | ||
} | ||
/** | ||
* Returns true if the given object is a function. | ||
*/ | ||
function isFunction(object) { | ||
return typeof object === 'function'; | ||
} | ||
/** | ||
* Returns true if the given object is an instanceof value | ||
* or its typeof is the given value. | ||
*/ | ||
function isA(object, value) { | ||
if (_isFunction2['default'](value)) return object instanceof value; | ||
if (isFunction(value)) return object instanceof value; | ||
@@ -977,7 +927,4 @@ if (value === 'array') return Array.isArray(object); | ||
exports['default'] = isA; | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 14 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -984,0 +931,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.expect=e():t.expect=e()}(this,function(){return function(t){function e(u){if(n[u])return n[u].exports;var r=n[u]={exports:{},id:u,loaded:!1};return t[u].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t){return new o["default"](t)}e.__esModule=!0;var a=n(3),o=u(a),i=n(4),s=n(2),l=u(s),c=n(7),f=u(c);r.createSpy=i.createSpy,r.spyOn=i.spyOn,r.isSpy=i.isSpy,r.restoreSpies=i.restoreSpies,r.assert=l["default"],r.extend=f["default"],e["default"]=r,t.exports=e["default"]},function(t,e){"use strict";function n(t){return"function"==typeof t}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){for(var n=arguments.length,u=Array(n>2?n-2:0),r=2;n>r;r++)u[r-2]=arguments[r];if(!t){var a=0;throw new Error(e.replace(/%s/g,function(){return o["default"](u[a++])}))}}e.__esModule=!0;var a=n(14),o=u(a);e["default"]=r,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var a=n(11),o=u(a),i=n(5),s=u(i),l=n(2),c=u(l),f=n(1),p=u(f),h=n(8),d=u(h),y=n(10),g=u(y),m=n(6),x=u(m),v=n(4),b=n(9),T=u(b),_=Array.isArray,E=function(){function t(e){r(this,t),this.actual=e,p["default"](e)&&(this.context=null,this.args=[])}return t.prototype.toExist=function(t){return c["default"](this.actual,t||"Expected %s to exist",this.actual),this},t.prototype.toNotExist=function(t){return c["default"](!this.actual,t||"Expected %s to not exist",this.actual),this},t.prototype.toBe=function(t,e){return c["default"](this.actual===t,e||"Expected %s to be %s",this.actual,t),this},t.prototype.toNotBe=function(t,e){return c["default"](this.actual!==t,e||"Expected %s to not be %s",this.actual,t),this},t.prototype.toEqual=function(t,e){try{c["default"](o["default"](this.actual,t),e||"Expected %s to equal %s",this.actual,t)}catch(n){throw n.showDiff=!0,n.actual=this.actual,n.expected=t,n}return this},t.prototype.toNotEqual=function(t,e){return c["default"](!o["default"](this.actual,t),e||"Expected %s to not equal %s",this.actual,t),this},t.prototype.toThrow=function(t,e){return c["default"](p["default"](this.actual),'The "actual" argument in expect(actual).toThrow() must be a function, %s was given',this.actual),c["default"](d["default"](this.actual,this.context,this.args,t),e||"Expected %s to throw %s",this.actual,t),this},t.prototype.toNotThrow=function(t,e){return c["default"](p["default"](this.actual),'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given',this.actual),c["default"](!d["default"](this.actual,this.context,this.args,t),e||"Expected %s to not throw %s",this.actual,t),this},t.prototype.toBeA=function(t,e){return c["default"](p["default"](t)||"string"==typeof t,'The "value" argument in toBeA(value) must be a function or a string'),c["default"](T["default"](this.actual,t),e||"Expected %s to be a %s",this.actual,t),this},t.prototype.toNotBeA=function(t,e){return c["default"](p["default"](t)||"string"==typeof t,'The "value" argument in toNotBeA(value) must be a function or a string'),c["default"](!T["default"](this.actual,t),e||"Expected %s to be a %s",this.actual,t),this},t.prototype.toMatch=function(t,e){return c["default"]("string"==typeof this.actual,'The "actual" argument in expect(actual).toMatch() must be a string'),c["default"](s["default"](t),'The "value" argument in toMatch(value) must be a RegExp'),c["default"](t.test(this.actual),e||"Expected %s to match %s",this.actual,t),this},t.prototype.toNotMatch=function(t,e){return c["default"]("string"==typeof this.actual,'The "actual" argument in expect(actual).toNotMatch() must be a string'),c["default"](s["default"](t),'The "value" argument in toNotMatch(value) must be a RegExp'),c["default"](!t.test(this.actual),e||"Expected %s to not match %s",this.actual,t),this},t.prototype.toBeLessThan=function(t,e){return c["default"]("number"==typeof this.actual,'The "actual" argument in expect(actual).toBeLessThan() must be a number'),c["default"]("number"==typeof t,'The "value" argument in toBeLessThan(value) must be a number'),c["default"](this.actual<t,e||"Expected %s to be less than %s",this.actual,t),this},t.prototype.toBeGreaterThan=function(t,e){return c["default"]("number"==typeof this.actual,'The "actual" argument in expect(actual).toBeGreaterThan() must be a number'),c["default"]("number"==typeof t,'The "value" argument in toBeGreaterThan(value) must be a number'),c["default"](this.actual>t,e||"Expected %s to be greater than %s",this.actual,t),this},t.prototype.toInclude=function(t,e,n){return c["default"](_(this.actual)||"string"==typeof this.actual,'The "actual" argument in expect(actual).toInclude() must be an array or a string'),"string"==typeof e&&(n=e,e=null),n=n||"Expected %s to include %s",_(this.actual)?c["default"](x["default"](this.actual,t,e),n,this.actual,t):c["default"](g["default"](this.actual,t),n,this.actual,t),this},t.prototype.toExclude=function(t,e,n){return c["default"](_(this.actual)||"string"==typeof this.actual,'The "actual" argument in expect(actual).toExclude() must be an array or a string'),"string"==typeof e&&(n=e,e=null),n=n||"Expected %s to exclude %s",_(this.actual)?c["default"](!x["default"](this.actual,t,e),n,this.actual,t):c["default"](!g["default"](this.actual,t),n,this.actual,t),this},t.prototype.toHaveBeenCalled=function(t){var e=this.actual;return c["default"](v.isSpy(e),'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy'),c["default"](e.calls.length>0,t||"spy was not called"),this},t.prototype.toHaveBeenCalledWith=function(){var t=this.actual;c["default"](v.isSpy(t),'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy');var e=Array.prototype.slice.call(arguments,0);return c["default"](t.calls.some(function(t){return o["default"](t.arguments,e)}),"spy was never called with %s",e),this},t.prototype.toNotHaveBeenCalled=function(t){var e=this.actual;return c["default"](v.isSpy(e),'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy'),c["default"](0===e.calls.length,t||"spy was not supposed to be called"),this},t.prototype.withContext=function(t){return c["default"](p["default"](this.actual),'The "actual" argument in expect(actual).withContext() must be a function'),this.context=t,this},t.prototype.withArgs=function(){return c["default"](p["default"](this.actual),'The "actual" argument in expect(actual).withArgs() must be a function'),arguments.length&&(this.args=this.args.concat(Array.prototype.slice.call(arguments,0))),this},t}(),j={toBeAn:"toBeA",toNotBeAn:"toNotBeA",toBeTruthy:"toExist",toBeFalsy:"toNotExist",toBeFewerThan:"toBeLessThan",toBeMoreThan:"toBeGreaterThan",toContain:"toInclude",toNotContain:"toExclude"};for(var w in j)E.prototype[w]=E.prototype[j[w]];e["default"]=E,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(){}function a(t){var e=arguments.length<=1||void 0===arguments[1]?r:arguments[1];null==t&&(t=r),c["default"](p["default"](t),"createSpy needs a function");var n=void 0,u=void 0,a=void 0,o=function i(){if(i.calls.push({context:this,arguments:Array.prototype.slice.call(arguments,0)}),n)return n.apply(this,arguments);if(u)throw u;return a};return o.calls=[],o.andCall=function(t){return n=t,o},o.andCallThrough=function(){return o.andCall(t)},o.andThrow=function(t){return u=t,o},o.andReturn=function(t){return a=t,o},o.getLastCall=function(){return o.calls[o.calls.length-1]},o.restore=o.destroy=e,o.__isSpy=!0,h.push(o),o}function o(t,e){var n=t[e];return i(n)||(c["default"](p["default"](n),"Cannot spyOn the %s property; it is not a function",e),t[e]=a(n,function(){t[e]=n})),t[e]}function i(t){return t&&t.__isSpy===!0}function s(){for(var t=h.length-1;t>=0;t--)h[t].restore();h=[]}e.__esModule=!0,e.createSpy=a,e.spyOn=o,e.isSpy=i,e.restoreSpies=s;var l=n(2),c=u(l),f=n(1),p=u(f),h=[]},function(t,e){"use strict";t.exports=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}},function(t,e){"use strict";function n(t,e,n){return null==n?-1!==t.indexOf(e):t.some(function(t){return n(t,e)!==!1})}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(-1===i.indexOf(t)){i.push(t);for(var e in t)t.hasOwnProperty(e)&&(o["default"].prototype[e]=t[e])}}e.__esModule=!0;var a=n(3),o=u(a),i=[];e["default"]=r,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t,e,n,u){try{t.apply(e,n)}catch(r){if(null==u)return!0;if(s["default"](u)&&r instanceof u)return!0;var a=r.message||r;if("string"==typeof a){if(o["default"](u)&&u.test(r.message))return!0;if("string"==typeof u&&-1!==a.indexOf(u))return!0}}return!1}e.__esModule=!0;var a=n(5),o=u(a),i=n(1),s=u(i);e["default"]=r,t.exports=e["default"]},function(t,e,n){"use strict";function u(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){return o["default"](e)?t instanceof e:"array"===e?Array.isArray(t):typeof t===e}e.__esModule=!0;var a=n(1),o=u(a);e["default"]=r,t.exports=e["default"]},function(t,e){"use strict";function n(t,e){return-1!==t.indexOf(e)}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,n){function u(t){return null===t||void 0===t}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:t.length>0&&"number"!=typeof t[0]?!1:!0:!1}function a(t,e,n){var a,c;if(u(t)||u(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return s(e)?(t=o.call(t),e=o.call(e),l(t,e,n)):!1;if(r(t)){if(!r(e))return!1;if(t.length!==e.length)return!1;for(a=0;a<t.length;a++)if(t[a]!==e[a])return!1;return!0}try{var f=i(t),p=i(e)}catch(h){return!1}if(f.length!=p.length)return!1;for(f.sort(),p.sort(),a=f.length-1;a>=0;a--)if(f[a]!=p[a])return!1;for(a=f.length-1;a>=0;a--)if(c=f[a],!l(t[c],e[c],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,i=n(13),s=n(12),l=t.exports=function(t,e,n){return n||(n={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:a(t,e,n)}},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function u(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=r?n:u,e.supported=n,e.unsupported=u},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e){function n(t){return String(t).replace(/"/g,""")}function u(t){return"[object Array]"===l(t)}function r(t){return"[object Date]"===l(t)}function a(t){return"[object RegExp]"===l(t)}function o(t){return"[object Error]"===l(t)}function i(t){return"[object Symbol]"===l(t)}function s(t,e){return d.call(t,e)}function l(t){return Object.prototype.toString.call(t)}function c(t){if(t.name)return t.name;var e=t.toString().match(/^function\s*([\w$]+)/);return e?e[1]:void 0}function f(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,u=t.length;u>n;n++)if(t[n]===e)return n;return-1}function p(t){return t&&"object"==typeof t?"undefined"!=typeof HTMLElement&&t instanceof HTMLElement?!0:"string"==typeof t.nodeName&&"function"==typeof t.getAttribute:!1}function h(t){function e(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(16>e?"0":"")+e.toString(16)}var n=t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,e);return"'"+n+"'"}t.exports=function y(t,e,l,d){function g(t,n){return n&&(d=d.slice(),d.push(n)),y(t,e,l+1,d)}e||(e={});var m=void 0===e.depth?5:e.depth;if(void 0===l&&(l=0),l>=m&&m>0&&t&&"object"==typeof t)return"[Object]";if(void 0===d)d=[];else if(f(d,t)>=0)return"[Circular]";if("string"==typeof t)return h(t);if("function"==typeof t){var x=c(t);return"[Function"+(x?": "+x:"")+"]"}if(null===t)return"null";if(i(t)){var v=Symbol.prototype.toString.call(t);return"object"==typeof t?"Object("+v+")":v}if(p(t)){for(var b="<"+String(t.nodeName).toLowerCase(),T=t.attributes||[],_=0;_<T.length;_++)b+=" "+T[_].name+'="'+n(T[_].value)+'"';return b+=">",t.childNodes&&t.childNodes.length&&(b+="..."),b+="</"+String(t.nodeName).toLowerCase()+">"}if(u(t)){if(0===t.length)return"[]";for(var E=Array(t.length),_=0;_<t.length;_++)E[_]=s(t,_)?g(t[_],t):"";return"[ "+E.join(", ")+" ]"}if(o(t)){var j=[];for(var w in t)s(t,w)&&(/[^\w$]/.test(w)?j.push(g(w)+": "+g(t[w])):j.push(w+": "+g(t[w])));return 0===j.length?"["+t+"]":"{ ["+t+"] "+j.join(", ")+" }"}if("object"==typeof t&&"function"==typeof t.inspect)return t.inspect();if("object"!=typeof t||r(t)||a(t))return String(t);var E=[],B=[];for(var w in t)s(t,w)&&B.push(w);B.sort();for(var _=0;_<B.length;_++){var w=B[_];/[^\w$]/.test(w)?E.push(g(w)+": "+g(t[w],t)):E.push(w+": "+g(t[w],t))}return 0===E.length?"{}":"{ "+E.join(", ")+" }"};var d=Object.prototype.hasOwnProperty||function(t){return t in this}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.expect=e():t.expect=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return t[r].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(t){return new o["default"](t)}e.__esModule=!0;var u=n(2),o=r(u),i=n(3),s=n(1),c=r(s),l=n(7),f=r(l);a.createSpy=i.createSpy,a.spyOn=i.spyOn,a.isSpy=i.isSpy,a.restoreSpies=i.restoreSpies,a.assert=c["default"],a.extend=f["default"],e["default"]=a,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;n>a;a++)r[a-2]=arguments[a];if(!t){var u=0;throw new Error(e.replace(/%s/g,function(){return o["default"](r[u++])}))}}e.__esModule=!0;var u=n(10),o=r(u);e["default"]=a,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var u=n(5),o=r(u),i=n(6),s=r(i),c=n(1),l=r(c),f=n(3),p=n(4),h=function(){function t(e){a(this,t),this.actual=e,p.isFunction(e)&&(this.context=null,this.args=[])}return t.prototype.toExist=function(t){return l["default"](this.actual,t||"Expected %s to exist",this.actual),this},t.prototype.toNotExist=function(t){return l["default"](!this.actual,t||"Expected %s to not exist",this.actual),this},t.prototype.toBe=function(t,e){return l["default"](this.actual===t,e||"Expected %s to be %s",this.actual,t),this},t.prototype.toNotBe=function(t,e){return l["default"](this.actual!==t,e||"Expected %s to not be %s",this.actual,t),this},t.prototype.toEqual=function(t,e){try{l["default"](o["default"](this.actual,t),e||"Expected %s to equal %s",this.actual,t)}catch(n){throw n.showDiff=!0,n.actual=this.actual,n.expected=t,n}return this},t.prototype.toNotEqual=function(t,e){return l["default"](!o["default"](this.actual,t),e||"Expected %s to not equal %s",this.actual,t),this},t.prototype.toThrow=function(t,e){return l["default"](p.isFunction(this.actual),'The "actual" argument in expect(actual).toThrow() must be a function, %s was given',this.actual),l["default"](p.functionThrows(this.actual,this.context,this.args,t),e||"Expected %s to throw %s",this.actual,t||"an error"),this},t.prototype.toNotThrow=function(t,e){return l["default"](p.isFunction(this.actual),'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given',this.actual),l["default"](!p.functionThrows(this.actual,this.context,this.args,t),e||"Expected %s to not throw %s",this.actual,t||"an error"),this},t.prototype.toBeA=function(t,e){return l["default"](p.isFunction(t)||"string"==typeof t,'The "value" argument in toBeA(value) must be a function or a string'),l["default"](p.isA(this.actual,t),e||"Expected %s to be a %s",this.actual,t),this},t.prototype.toNotBeA=function(t,e){return l["default"](p.isFunction(t)||"string"==typeof t,'The "value" argument in toNotBeA(value) must be a function or a string'),l["default"](!p.isA(this.actual,t),e||"Expected %s to be a %s",this.actual,t),this},t.prototype.toMatch=function(t,e){return l["default"]("string"==typeof this.actual,'The "actual" argument in expect(actual).toMatch() must be a string'),l["default"](s["default"](t),'The "value" argument in toMatch(value) must be a RegExp'),l["default"](t.test(this.actual),e||"Expected %s to match %s",this.actual,t),this},t.prototype.toNotMatch=function(t,e){return l["default"]("string"==typeof this.actual,'The "actual" argument in expect(actual).toNotMatch() must be a string'),l["default"](s["default"](t),'The "value" argument in toNotMatch(value) must be a RegExp'),l["default"](!t.test(this.actual),e||"Expected %s to not match %s",this.actual,t),this},t.prototype.toBeLessThan=function(t,e){return l["default"]("number"==typeof this.actual,'The "actual" argument in expect(actual).toBeLessThan() must be a number'),l["default"]("number"==typeof t,'The "value" argument in toBeLessThan(value) must be a number'),l["default"](this.actual<t,e||"Expected %s to be less than %s",this.actual,t),this},t.prototype.toBeGreaterThan=function(t,e){return l["default"]("number"==typeof this.actual,'The "actual" argument in expect(actual).toBeGreaterThan() must be a number'),l["default"]("number"==typeof t,'The "value" argument in toBeGreaterThan(value) must be a number'),l["default"](this.actual>t,e||"Expected %s to be greater than %s",this.actual,t),this},t.prototype.toInclude=function(t,e,n){return l["default"](p.isArray(this.actual)||"string"==typeof this.actual,'The "actual" argument in expect(actual).toInclude() must be an array or a string'),"string"==typeof e&&(n=e,e=null),n=n||"Expected %s to include %s",p.isArray(this.actual)?l["default"](p.arrayContains(this.actual,t,e),n,this.actual,t):l["default"](p.stringContains(this.actual,t),n,this.actual,t),this},t.prototype.toExclude=function(t,e,n){return l["default"](p.isArray(this.actual)||"string"==typeof this.actual,'The "actual" argument in expect(actual).toExclude() must be an array or a string'),"string"==typeof e&&(n=e,e=null),n=n||"Expected %s to exclude %s",p.isArray(this.actual)?l["default"](!p.arrayContains(this.actual,t,e),n,this.actual,t):l["default"](!p.stringContains(this.actual,t),n,this.actual,t),this},t.prototype.toHaveBeenCalled=function(t){var e=this.actual;return l["default"](f.isSpy(e),'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy'),l["default"](e.calls.length>0,t||"spy was not called"),this},t.prototype.toHaveBeenCalledWith=function(){var t=this.actual;l["default"](f.isSpy(t),'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy');var e=Array.prototype.slice.call(arguments,0);return l["default"](t.calls.some(function(t){return o["default"](t.arguments,e)}),"spy was never called with %s",e),this},t.prototype.toNotHaveBeenCalled=function(t){var e=this.actual;return l["default"](f.isSpy(e),'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy'),l["default"](0===e.calls.length,t||"spy was not supposed to be called"),this},t.prototype.withContext=function(t){return l["default"](p.isFunction(this.actual),'The "actual" argument in expect(actual).withContext() must be a function'),this.context=t,this},t.prototype.withArgs=function(){return l["default"](p.isFunction(this.actual),'The "actual" argument in expect(actual).withArgs() must be a function'),arguments.length&&(this.args=this.args.concat(Array.prototype.slice.call(arguments,0))),this},t}(),d={toBeAn:"toBeA",toNotBeAn:"toNotBeA",toBeTruthy:"toExist",toBeFalsy:"toNotExist",toBeFewerThan:"toBeLessThan",toBeMoreThan:"toBeGreaterThan",toContain:"toInclude",toNotContain:"toExclude"};for(var y in d)h.prototype[y]=h.prototype[d[y]];e["default"]=h,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(){}function u(t){var e=arguments.length<=1||void 0===arguments[1]?a:arguments[1];null==t&&(t=a),l["default"](f.isFunction(t),"createSpy needs a function");var n=void 0,r=void 0,u=void 0,o=function i(){if(i.calls.push({context:this,arguments:Array.prototype.slice.call(arguments,0)}),n)return n.apply(this,arguments);if(r)throw r;return u};return o.calls=[],o.andCall=function(t){return n=t,o},o.andCallThrough=function(){return o.andCall(t)},o.andThrow=function(t){return r=t,o},o.andReturn=function(t){return u=t,o},o.getLastCall=function(){return o.calls[o.calls.length-1]},o.restore=o.destroy=e,o.__isSpy=!0,p.push(o),o}function o(t,e){var n=t[e];return i(n)||(l["default"](f.isFunction(n),"Cannot spyOn the %s property; it is not a function",e),t[e]=u(n,function(){t[e]=n})),t[e]}function i(t){return t&&t.__isSpy===!0}function s(){for(var t=p.length-1;t>=0;t--)p[t].restore();p=[]}e.__esModule=!0,e.createSpy=u,e.spyOn=o,e.isSpy=i,e.restoreSpies=s;var c=n(1),l=r(c),f=n(4),p=[]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(t,e,n,r){try{t.apply(e,n)}catch(a){if(null==r)return!0;if(s(r)&&a instanceof r)return!0;var u=a.message||a;if("string"==typeof u){if(h["default"](r)&&r.test(a.message))return!0;if("string"==typeof r&&-1!==u.indexOf(r))return!0}}return!1}function u(t,e,n){return null==n&&(n=f["default"]),t.some(function(t){return n(t,e)!==!1})}function o(t,e){return-1!==t.indexOf(e)}function i(t){return Array.isArray(t)}function s(t){return"function"==typeof t}function c(t,e){return s(e)?t instanceof e:"array"===e?Array.isArray(t):typeof t===e}e.__esModule=!0,e.functionThrows=a,e.arrayContains=u,e.stringContains=o,e.isArray=i,e.isFunction=s,e.isA=c;var l=n(5),f=r(l),p=n(6),h=r(p)},function(t,e,n){function r(t){return null===t||void 0===t}function a(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:t.length>0&&"number"!=typeof t[0]?!1:!0:!1}function u(t,e,n){var u,l;if(r(t)||r(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return s(e)?(t=o.call(t),e=o.call(e),c(t,e,n)):!1;if(a(t)){if(!a(e))return!1;if(t.length!==e.length)return!1;for(u=0;u<t.length;u++)if(t[u]!==e[u])return!1;return!0}try{var f=i(t),p=i(e)}catch(h){return!1}if(f.length!=p.length)return!1;for(f.sort(),p.sort(),u=f.length-1;u>=0;u--)if(f[u]!=p[u])return!1;for(u=f.length-1;u>=0;u--)if(l=f[u],!c(t[l],e[l],n))return!1;return typeof t==typeof e}var o=Array.prototype.slice,i=n(9),s=n(8),c=t.exports=function(t,e,n){return n||(n={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:u(t,e,n)}},function(t,e){"use strict";t.exports=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function a(t){if(-1===i.indexOf(t)){i.push(t);for(var e in t)t.hasOwnProperty(e)&&(o["default"].prototype[e]=t[e])}}e.__esModule=!0;var u=n(2),o=r(u),i=[];e["default"]=a,t.exports=e["default"]},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var a="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=a?n:r,e.supported=n,e.unsupported=r},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e){function n(t){return String(t).replace(/"/g,""")}function r(t){return"[object Array]"===c(t)}function a(t){return"[object Date]"===c(t)}function u(t){return"[object RegExp]"===c(t)}function o(t){return"[object Error]"===c(t)}function i(t){return"[object Symbol]"===c(t)}function s(t,e){return d.call(t,e)}function c(t){return Object.prototype.toString.call(t)}function l(t){if(t.name)return t.name;var e=t.toString().match(/^function\s*([\w$]+)/);return e?e[1]:void 0}function f(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1}function p(t){return t&&"object"==typeof t?"undefined"!=typeof HTMLElement&&t instanceof HTMLElement?!0:"string"==typeof t.nodeName&&"function"==typeof t.getAttribute:!1}function h(t){function e(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(16>e?"0":"")+e.toString(16)}var n=t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,e);return"'"+n+"'"}t.exports=function y(t,e,c,d){function g(t,n){return n&&(d=d.slice(),d.push(n)),y(t,e,c+1,d)}e||(e={});var m=void 0===e.depth?5:e.depth;if(void 0===c&&(c=0),c>=m&&m>0&&t&&"object"==typeof t)return"[Object]";if(void 0===d)d=[];else if(f(d,t)>=0)return"[Circular]";if("string"==typeof t)return h(t);if("function"==typeof t){var x=l(t);return"[Function"+(x?": "+x:"")+"]"}if(null===t)return"null";if(i(t)){var b=Symbol.prototype.toString.call(t);return"object"==typeof t?"Object("+b+")":b}if(p(t)){for(var v="<"+String(t.nodeName).toLowerCase(),T=t.attributes||[],w=0;w<T.length;w++)v+=" "+T[w].name+'="'+n(T[w].value)+'"';return v+=">",t.childNodes&&t.childNodes.length&&(v+="..."),v+="</"+String(t.nodeName).toLowerCase()+">"}if(r(t)){if(0===t.length)return"[]";for(var E=Array(t.length),w=0;w<t.length;w++)E[w]=s(t,w)?g(t[w],t):"";return"[ "+E.join(", ")+" ]"}if(o(t)){var j=[];for(var A in t)s(t,A)&&(/[^\w$]/.test(A)?j.push(g(A)+": "+g(t[A])):j.push(A+": "+g(t[A])));return 0===j.length?"["+t+"]":"{ ["+t+"] "+j.join(", ")+" }"}if("object"==typeof t&&"function"==typeof t.inspect)return t.inspect();if("object"!=typeof t||a(t)||u(t))return String(t);var E=[],B=[];for(var A in t)s(t,A)&&B.push(A);B.sort();for(var w=0;w<B.length;w++){var A=B[w];/[^\w$]/.test(A)?E.push(g(A)+": "+g(t[A],t)):E.push(A+": "+g(t[A],t))}return 0===E.length?"{}":"{ "+E.join(", ")+" }"};var d=Object.prototype.hasOwnProperty||function(t){return t in this}}])}); |
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
86494
1672
16
25
416