unassessed
Version:
Extensible type-aware assertion library
2 lines (1 loc) • 35.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).unassessed=t()}(this,(function(){var e=function(e,t){var o={};return Object.keys(t).forEach((function(n){var r=t[n],a=r.assertionString,s=r.isNestingAllowed,i=r.typesOfValues;o[n]=s?function(e,t){return function(o,n){return e(o,t,n)}}(e,a):function(e,t,o,n){return 0===t.length?function(t){return e(t,o)}:2===t.length?function(t,r,a){if(r&&r.__itPlaceholder||a&&a.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by ."+n+"()");return e(t,o,r,a)}:function(t){for(var r=[],a=arguments.length-1;a-- >0;)r[a]=arguments[a+1];var s=1===r.length?r[0]:void 0;if(s&&s.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by ."+n+"()");var i=1===r.length?[s]:[];return e.apply(void 0,[t,o].concat(i))}}(e,i,a,n)})),o};var t=function(e){var t={},o={};return Object.keys(e.assertions).forEach((function(n){var r=e.assertions[n];n.endsWith(" assertion")?o[n]=r:t[n]=r})),Object.keys(o).forEach((function(e){var n,r=o[e];if(r.length>1&&(n=r.find((function(e){return e.declaration.endsWith("<assertion>")})))){var a=e.slice(0,-" assertion".length);t[a]?t[a].push(n):t[e]=r}})),t},o={called:!0,"when called":!0,"called with":!0,"when called with":!0,"decoded as":!0,"when decoded as":!0,"passed as parameter to":!0,"when passed as parameter to":!0,"passed as parameters to":!0,"when passed as parameters to":!0,"passed as parameter to async":!0,"when passed as parameter to async":!0,"passed as parameters to async":!0,"passed as parameter to constructor":!0,"when passed as parameter to constructor":!0,"when passed as parameters to async":!0,"passed as parameters to constructor":!0,"when passed as parameters to constructor":!0,sorted:!0,"when sorted":!0,"sorted by":!0,"when sorted by":!0,"sorted numerically":!0,"when sorted numerically":!0,"when fulfilled":!0,"when rejected":!0,"not to only have own properties":!0,"not to only have properties":!0,"to have key":!0,"to only have key":!0,"to not have key":!0,"to not only have key":!0,"not to have key":!0,"to have keys":!0,"to only have keys":!0,"to not have keys":!0,"to not only have keys":!0,"not to have keys":!0,"to be ok":!0,"not to be ok":!0},n={"to be falsy":!0,"to be truthy":!0,"not to be falsy":!0,"not to be truthy":!0};function r(e){return e[0].toUpperCase()+e.slice(1)}function a(e,t){var o=e.assertions[t],n=[];return o.forEach((function(e){var t=e.declaration.match(/(?: <([a-zA-z-]+[+?]?(?:[|][a-zA-z-]+)*)>)* <([a-zA-z-]+[+?]?(?:[|][a-zA-z-]+)*)>$/);t&&t.slice(1).filter(Boolean).forEach((function(e,t){if(e){var o;n.length<=t?(o=new Set,n.push(o)):o=n[t];var r=e.split("|");(r=r.map((function(e){return e.endsWith("+")?e.slice(0,-1):e}))).map((function(e){return o.add(e)}))}}))})),n}function s(e){var t=e.length>0&&(e[e.length-1].has("assertion?")||e[e.length-1].has("assertion")),o=t&&e[e.length-1];return{isMiddleRocket:t&&1===o.size,isNestingAllowed:t&&o.size>1}}var i=function(e,t){var i={};return Object.keys(t).forEach((function(t){var l=t.split(" "),u=l[0];if(!(t in o||l.includes("non-empty"))){var h=u+l.slice(1).map(r).join(""),d=t in n?[]:a(e,t);if(!i[h]||!i[h].isNestingAllowed){var c=s(d),f=c.isMiddleRocket,v=c.isNestingAllowed;i[h]={assertionString:t,isMiddleRocket:f,isNestingAllowed:v,typesOfValues:d}}}})),i},l=a,u=s;i.determineTypesOfValues=l,i.identifyTypesOfValues=u;var h=function(e){return{notToBeTruthy:function(t){return e(t,"not to be truthy")},toBeTruthy:function(t){return e(t,"to be truthy")},notToBe:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBe()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be"].concat(a))},toBe:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBe()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be"].concat(a))},notToBeTrue:function(t){return e(t,"not to be true")},toBeTrue:function(t){return e(t,"to be true")},notToBeFalse:function(t){return e(t,"not to be false")},toBeFalse:function(t){return e(t,"to be false")},notToBeFalsy:function(t){return e(t,"not to be falsy")},toBeFalsy:function(t){return e(t,"to be falsy")},notToBeNull:function(t){return e(t,"not to be null")},toBeNull:function(t){return e(t,"to be null")},notToBeUndefined:function(t){return e(t,"not to be undefined")},toBeUndefined:function(t){return e(t,"to be undefined")},notToBeDefined:function(t){return e(t,"not to be defined")},toBeDefined:function(t){return e(t,"to be defined")},notToBeNaN:function(t){return e(t,"not to be NaN")},toBeNaN:function(t){return e(t,"to be NaN")},notToBeCloseTo:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeCloseTo()");return e(t,"not to be close to",o,n)},toBeCloseTo:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeCloseTo()");return e(t,"to be close to",o,n)},notToBeA:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeA()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be a"].concat(a))},notToBeAn:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeAn()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be an"].concat(a))},toBeA:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeA()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be a"].concat(a))},toBeAn:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeAn()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be an"].concat(a))},notToBeOneOf:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeOneOf()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be one of"].concat(a))},toBeOneOf:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeOneOf()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be one of"].concat(a))},notToBeAnObject:function(t){return e(t,"not to be an object")},notToBeAnArray:function(t){return e(t,"not to be an array")},toBeAnObject:function(t){return e(t,"to be an object")},toBeAnArray:function(t){return e(t,"to be an array")},notToBeABoolean:function(t){return e(t,"not to be a boolean")},notToBeANumber:function(t){return e(t,"not to be a number")},notToBeAString:function(t){return e(t,"not to be a string")},notToBeAFunction:function(t){return e(t,"not to be a function")},notToBeARegexp:function(t){return e(t,"not to be a regexp")},notToBeARegex:function(t){return e(t,"not to be a regex")},notToBeARegularExpression:function(t){return e(t,"not to be a regular expression")},notToBeADate:function(t){return e(t,"not to be a date")},toBeABoolean:function(t){return e(t,"to be a boolean")},toBeANumber:function(t){return e(t,"to be a number")},toBeAString:function(t){return e(t,"to be a string")},toBeAFunction:function(t){return e(t,"to be a function")},toBeARegexp:function(t){return e(t,"to be a regexp")},toBeARegex:function(t){return e(t,"to be a regex")},toBeARegularExpression:function(t){return e(t,"to be a regular expression")},toBeADate:function(t){return e(t,"to be a date")},toBeTheEmptyString:function(t){return e(t,"to be the empty string")},toBeAnEmptyString:function(t){return e(t,"to be an empty string")},toBeTheEmptyArray:function(t){return e(t,"to be the empty array")},toBeAnEmptyArray:function(t){return e(t,"to be an empty array")},toMatch:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toMatch()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to match"].concat(a))},notToMatch:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToMatch()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to match"].concat(a))},notToHaveOwnProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveOwnProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have own property"].concat(a))},toHaveOwnProperty:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveOwnProperty()");return e(t,"to have own property",o,n)},notToHaveEnumerableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveEnumerableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have enumerable property"].concat(a))},notToHaveConfigurableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveConfigurableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have configurable property"].concat(a))},notToHaveWritableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveWritableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have writable property"].concat(a))},toHaveEnumerableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveEnumerableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have enumerable property"].concat(a))},toHaveConfigurableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveConfigurableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have configurable property"].concat(a))},toHaveWritableProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveWritableProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have writable property"].concat(a))},notToHaveProperty:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveProperty()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have property"].concat(a))},toHaveProperty:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveProperty()");return e(t,"to have property",o,n)},notToHaveOwnProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveOwnProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have own properties"].concat(a))},notToHaveProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have properties"].concat(a))},toOnlyHaveOwnProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toOnlyHaveOwnProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to only have own properties"].concat(a))},toOnlyHaveProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toOnlyHaveProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to only have properties"].concat(a))},toHaveOwnProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveOwnProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have own properties"].concat(a))},toHaveProperties:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveProperties()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have properties"].concat(a))},notToHaveLength:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToHaveLength()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to have length"].concat(a))},toHaveLength:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveLength()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have length"].concat(a))},notToBeEmpty:function(t){return e(t,"not to be empty")},toBeEmpty:function(t){return e(t,"to be empty")},notToContain:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToContain()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to contain"].concat(a))},toContain:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toContain()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to contain"].concat(a))},notToBeginWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeginWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to begin with"].concat(a))},toBeginWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeginWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to begin with"].concat(a))},notToStartWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToStartWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to start with"].concat(a))},toStartWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toStartWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to start with"].concat(a))},notToEndWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToEndWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to end with"].concat(a))},toEndWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toEndWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to end with"].concat(a))},notToBeFinite:function(t){return e(t,"not to be finite")},toBeFinite:function(t){return e(t,"to be finite")},notToBeInfinite:function(t){return e(t,"not to be infinite")},toBeInfinite:function(t){return e(t,"to be infinite")},notToBeWithin:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeWithin()");return e(t,"not to be within",o,n)},toBeWithin:function(t,o,n){if(o&&o.__itPlaceholder||n&&n.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeWithin()");return e(t,"to be within",o,n)},notToBeLessThan:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeLessThan()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be less than"].concat(a))},notToBeBelow:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeBelow()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be below"].concat(a))},toBeLessThan:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeLessThan()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be less than"].concat(a))},toBeBelow:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeBelow()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be below"].concat(a))},notToBeLessThanOrEqualTo:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeLessThanOrEqualTo()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be less than or equal to"].concat(a))},toBeLessThanOrEqualTo:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeLessThanOrEqualTo()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be less than or equal to"].concat(a))},notToBeGreaterThan:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeGreaterThan()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be greater than"].concat(a))},notToBeAbove:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeAbove()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be above"].concat(a))},toBeGreaterThan:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeGreaterThan()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be greater than"].concat(a))},toBeAbove:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeAbove()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be above"].concat(a))},notToBeGreaterThanOrEqualTo:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToBeGreaterThanOrEqualTo()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to be greater than or equal to"].concat(a))},toBeGreaterThanOrEqualTo:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeGreaterThanOrEqualTo()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be greater than or equal to"].concat(a))},notToBePositive:function(t){return e(t,"not to be positive")},toBePositive:function(t){return e(t,"to be positive")},notToBeNegative:function(t){return e(t,"not to be negative")},toBeNegative:function(t){return e(t,"to be negative")},toEqual:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toEqual()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to equal"].concat(a))},notToEqual:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToEqual()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to equal"].concat(a))},toError:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toError()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to error"].concat(a))},toErrorWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toErrorWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to error with"].concat(a))},notToError:function(t){return e(t,"not to error")},notToThrow:function(t){return e(t,"not to throw")},toThrow:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toThrow()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to throw"].concat(a))},toThrowError:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toThrowError()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to throw error"].concat(a))},toThrowException:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toThrowException()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to throw exception"].concat(a))},toSatisfy:function(t,o){return e(t,"to satisfy",o)},toThrowA:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toThrowA()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to throw a"].concat(a))},toThrowAn:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toThrowAn()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to throw an"].concat(a))},toHaveArity:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveArity()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have arity"].concat(a))},toHaveValuesExhaustivelySatisfying:function(t,o){return e(t,"to have values exhaustively satisfying",o)},toHaveValuesSatisfying:function(t,o){return e(t,"to have values satisfying",o)},toBeAMapWhoseValuesExhaustivelySatisfy:function(t,o){return e(t,"to be a map whose values exhaustively satisfy",o)},toBeAMapWhoseValuesSatisfy:function(t,o){return e(t,"to be a map whose values satisfy",o)},toBeAHashWhoseValuesExhaustivelySatisfy:function(t,o){return e(t,"to be a hash whose values exhaustively satisfy",o)},toBeAHashWhoseValuesSatisfy:function(t,o){return e(t,"to be a hash whose values satisfy",o)},toBeAnObjectWhoseValuesExhaustivelySatisfy:function(t,o){return e(t,"to be an object whose values exhaustively satisfy",o)},toBeAnObjectWhoseValuesSatisfy:function(t,o){return e(t,"to be an object whose values satisfy",o)},toHaveItemsExhaustivelySatisfying:function(t,o){return e(t,"to have items exhaustively satisfying",o)},toHaveItemsSatisfying:function(t,o){return e(t,"to have items satisfying",o)},toBeAnArrayWhoseItemsExhaustivelySatisfy:function(t,o){return e(t,"to be an array whose items exhaustively satisfy",o)},toBeAnArrayWhoseItemsSatisfy:function(t,o){return e(t,"to be an array whose items satisfy",o)},toHaveKeysSatisfying:function(t,o){return e(t,"to have keys satisfying",o)},toBeAMapWhoseKeysSatisfy:function(t,o){return e(t,"to be a map whose keys satisfy",o)},toBeAMapWhosePropertiesSatisfy:function(t,o){return e(t,"to be a map whose properties satisfy",o)},toBeAHashWhoseKeysSatisfy:function(t,o){return e(t,"to be a hash whose keys satisfy",o)},toBeAHashWhosePropertiesSatisfy:function(t,o){return e(t,"to be a hash whose properties satisfy",o)},toBeAnObjectWhoseKeysSatisfy:function(t,o){return e(t,"to be an object whose keys satisfy",o)},toBeAnObjectWhosePropertiesSatisfy:function(t,o){return e(t,"to be an object whose properties satisfy",o)},notToHaveAValueExhaustivelySatisfying:function(t,o){return e(t,"not to have a value exhaustively satisfying",o)},notToHaveAValueSatisfying:function(t,o){return e(t,"not to have a value satisfying",o)},toHaveAValueExhaustivelySatisfying:function(t,o){return e(t,"to have a value exhaustively satisfying",o)},toHaveAValueSatisfying:function(t,o){return e(t,"to have a value satisfying",o)},notToHaveAnItemExhaustivelySatisfying:function(t,o){return e(t,"not to have an item exhaustively satisfying",o)},notToHaveAnItemSatisfying:function(t,o){return e(t,"not to have an item satisfying",o)},toHaveAnItemExhaustivelySatisfying:function(t,o){return e(t,"to have an item exhaustively satisfying",o)},toHaveAnItemSatisfying:function(t,o){return e(t,"to have an item satisfying",o)},toBeCanonical:function(t){return e(t,"to be canonical")},toHaveMessage:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toHaveMessage()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to have message"].concat(a))},toExhaustivelySatisfy:function(t,o){return e(t,"to exhaustively satisfy",o)},notToExhaustivelySatisfy:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToExhaustivelySatisfy()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to exhaustively satisfy"].concat(a))},notToSatisfy:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .notToSatisfy()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"not to satisfy"].concat(a))},toBeRejected:function(t){return e(t,"to be rejected")},toBeRejectedWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeRejectedWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be rejected with"].concat(a))},toBeRejectedWithErrorExhaustivelySatisfying:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeRejectedWithErrorExhaustivelySatisfying()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be rejected with error exhaustively satisfying"].concat(a))},toBeRejectedWithErrorSatisfying:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeRejectedWithErrorSatisfying()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be rejected with error satisfying"].concat(a))},toBeFulfilled:function(t){return e(t,"to be fulfilled")},toBeFulfilledWith:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeFulfilledWith()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be fulfilled with"].concat(a))},toBeFulfilledWithValueExhaustivelySatisfying:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeFulfilledWithValueExhaustivelySatisfying()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be fulfilled with value exhaustively satisfying"].concat(a))},toBeFulfilledWithValueSatisfying:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toBeFulfilledWithValueSatisfying()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to be fulfilled with value satisfying"].concat(a))},toCallTheCallback:function(t){return e(t,"to call the callback")},toCallTheCallbackWithoutError:function(t){return e(t,"to call the callback without error")},toCallTheCallbackWithError:function(t){for(var o=[],n=arguments.length-1;n-- >0;)o[n]=arguments[n+1];var r=1===o.length?o[0]:void 0;if(r&&r.__itPlaceholder)throw new Error("unassessed: nested assertions are not supported by .toCallTheCallbackWithError()");var a=1===o.length?[r]:[];return e.apply(void 0,[t,"to call the callback with error"].concat(a))}}},d="undefined"!=typeof weknowhow?weknowhow.expect:require("unexpected");function c(e,t){for(var o=[],n=t.length,r=e.length;r<n;r++)o.push(t[r]);return o}var f=!1,v=null;var p=function(e,t,o){this.name=e,this.assertion=t,this.args=o};function y(e,t){var o,n=t.assertion,r=t.args;return(o=e.it((function(t){return e.apply(void 0,[t,n].concat(r))}))).__itReference=t,o}function g(o,n){var r=0;o.hook((function(e){return function(t,n){var a,s=n.slice(2);1===s.length&&s[0]instanceof p&&n.splice(2,1,y(o,s[0])),r-=1;try{a=e(t,n)}catch(e){throw r=0,e}return a.isPending()&&a.finally((function(){return r=0})),a}})),o.addType({name:"itFunction",base:"expect.it",identify:function(e){return this.baseType.identify(e)&&e.__itReference instanceof p},inspect:function(e,t,o,n){var r=e.__itReference,a=r.assertion,s=r.args,i=o.clone();s.forEach((function(e){i.sp().append(n(e))})),o.error(a).append(i)}}),o.addType({name:"ItPlaceholder",base:"wrapperObject",identify:function(e){return e instanceof p},inspect:function(e,t,o,n){return o.append(this.prefix(o.clone(),e)),e.args.length>0&&e.args.forEach((function(t,n){n>0&&o.text(", "),o.appendInspected.apply(o,e.args)})),o.append(this.suffix(o.clone(),e)),o},unwrap:function(e){return y(o,e)},prefix:function(e,t){var o=t.name;return e.text("assess.it."+o+"(")},suffix:function(e){return e.text(")")}}),o.addAssertion("<any> to [exhaustively] satisfy <ItPlaceholder>",(function(e,t,o){return e(t,"to [exhaustively] satisfy",e.argTypes[0].unwrap(o))})),n=n||e;var a=t(o),s=i(o,a),l=n(o,s);function u(e){for(var t=[],o=arguments.length-1;o-- >0;)t[o]=arguments[o+1];if(t.length>0)throw new Error("unassessed: at most one subject argument accepted");r+=1,v||(v=function(){var e=r;if(r=0,e>0)throw new Error("unassessed: dangling assertion created")});var n={};return function(e,t,o,n){Object.keys(o).forEach((function(r){t[r].isMiddleRocket||(e[r]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return o[r].apply(o,[n].concat(e))})}))}(n,s,l,e),n}function h(){throw r=0,new Error("unassessed: asssess.it was called directly. Please use its methods instead.")}return function(e,t,o,n){Object.keys(o).forEach((function(o){var r=t[o],a=r.assertionString,s=r.isMiddleRocket,i=r.isNestingAllowed;s||(e[o]=i?function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e.length>0&&e[0].__itPlaceholder)throw new Error("unassessed: nested assertions are not supported with .it. functions.");return n(),new p(o,a,e)}:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n(),new p(o,a,e)})}))}(h,s,l,(function(){r-=1})),u.it=h,u.setOutputWidth=function(e){if(!("number"==typeof e&&e==e&&e>0))throw new Error("unassessed: invalid output width");o.output.preferredWidth=e},u.withPlugins=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var o=d.clone();e.forEach((function(e){o.use(e)}));var n=Object.getOwnPropertyNames(d),r=Object.getOwnPropertyNames(o),a=c(n,r),s=g(o);return a.forEach((function(e){return s[e]=o[e]})),s},u.withUnexpectedPlugins=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return u.withPlugins.apply(u,e)},"function"!=typeof afterEach||f||(f=!0,afterEach((function(){var e=v;v=null,e&&e()}))),u}return p.prototype.__itPlaceholder=!0,g(d.clone(),h)}));