hamjest 3.7.3 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +15 -11
- package/dist/hamjest.js +6542 -23401
- package/dist/hamjest.min.js +1 -1
- package/gulpfile.js +0 -2
- package/index.js +95 -1
- package/lib/Description.js +32 -22
- package/lib/assertThat.js +4 -4
- package/lib/matchers/AllOf.js +8 -5
- package/lib/matchers/AnyOf.js +8 -8
- package/lib/matchers/DateComparisonMatcher.js +25 -24
- package/lib/matchers/Every.js +17 -11
- package/lib/matchers/FeatureMatcher.js +2 -2
- package/lib/matchers/Is.js +6 -5
- package/lib/matchers/IsAnything.js +2 -2
- package/lib/matchers/IsArray.js +4 -3
- package/lib/matchers/IsArrayContaining.js +8 -6
- package/lib/matchers/IsArrayContainingInAnyOrder.js +11 -8
- package/lib/matchers/IsArrayOrderedBy.js +5 -4
- package/lib/matchers/IsArrayWithItem.js +11 -8
- package/lib/matchers/IsArrayWithItems.js +6 -4
- package/lib/matchers/IsBoolean.js +4 -3
- package/lib/matchers/IsCloseTo.js +2 -2
- package/lib/matchers/IsDate.js +4 -3
- package/lib/matchers/IsDefined.js +4 -3
- package/lib/matchers/IsEqual.js +4 -3
- package/lib/matchers/IsFulfilled.js +2 -2
- package/lib/matchers/IsFunction.js +4 -3
- package/lib/matchers/IsFunctionThrowing.js +2 -2
- package/lib/matchers/IsInstanceOf.js +4 -3
- package/lib/matchers/IsNot.js +6 -5
- package/lib/matchers/IsNumber.js +4 -3
- package/lib/matchers/IsObject.js +4 -3
- package/lib/matchers/IsObjectWithProperties.js +19 -12
- package/lib/matchers/IsPromise.js +4 -3
- package/lib/matchers/IsRegExp.js +5 -6
- package/lib/matchers/IsRejected.js +2 -2
- package/lib/matchers/IsSame.js +2 -2
- package/lib/matchers/IsString.js +4 -3
- package/lib/matchers/IsStringMatching.js +2 -2
- package/lib/matchers/Matcher.js +10 -7
- package/lib/matchers/NumberComparisonMatcher.js +17 -16
- package/lib/matchers/SubstringMatcher.js +42 -39
- package/lib/matchers/failsToMatch.js +2 -2
- package/lib/matchers/falsy.js +2 -2
- package/lib/matchers/hasDescription.js +6 -5
- package/lib/matchers/hasExactlyOneItem.js +11 -8
- package/lib/matchers/hasSize.js +7 -4
- package/lib/matchers/inRange.js +11 -8
- package/lib/matchers/isEmpty.js +2 -2
- package/lib/matchers/matches.js +2 -2
- package/lib/matchers/promiseAgnostic.js +35 -15
- package/lib/matchers/returns.js +2 -2
- package/lib/matchers/truthy.js +2 -2
- package/lib/promiseThat.js +7 -9
- package/package.json +4 -5
- package/test/node/assertThatSpec.js +1 -3
- package/test/node/deferMatcher.js +2 -4
- package/test/node/esm/.eslintrc +5 -0
- package/test/node/esm/package.json +3 -0
- package/test/node/esm/providesNamedImports.js +3 -0
- package/test/node/matchers/AllOfSpec.js +1 -1
- package/test/node/matchers/AnyOfSpec.js +1 -1
- package/test/node/matchers/IsFulfilledSpec.js +29 -30
- package/test/node/matchers/IsPromiseSpec.js +3 -4
- package/test/node/matchers/IsRejectedSpec.js +21 -22
- package/test/node/promiseThatSpec.js +49 -86
- package/lib/hamjest.js +0 -106
- package/tags +0 -2855
package/lib/hamjest.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
const IsEqual = require('./matchers/IsEqual');
|
|
5
|
-
const Matcher = require('./matchers/Matcher');
|
|
6
|
-
const SubstringMatcher = require('./matchers/SubstringMatcher');
|
|
7
|
-
const NumberComparisonMatcher = require('./matchers/NumberComparisonMatcher');
|
|
8
|
-
const DateComparisonMatcher = require('./matchers/DateComparisonMatcher');
|
|
9
|
-
const Description = require('./Description');
|
|
10
|
-
|
|
11
|
-
require('./fixErrorJson')();
|
|
12
|
-
|
|
13
|
-
const asserts = {
|
|
14
|
-
assertThat: require('./assertThat'),
|
|
15
|
-
promiseThat: require('./promiseThat'),
|
|
16
|
-
fail: require('./fail')
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const matchers = {
|
|
20
|
-
Matcher: Matcher,
|
|
21
|
-
TypeSafeMatcher: require('./matchers/TypeSafeMatcher'),
|
|
22
|
-
FeatureMatcher: require('./matchers/FeatureMatcher'),
|
|
23
|
-
|
|
24
|
-
anything: require('./matchers/IsAnything').anything,
|
|
25
|
-
strictlyEqualTo: require('./matchers/IsSame').strictlyEqualTo,
|
|
26
|
-
is: require('./matchers/Is').is,
|
|
27
|
-
not: require('./matchers/IsNot').not,
|
|
28
|
-
equalTo: IsEqual.equalTo,
|
|
29
|
-
truthy: require('./matchers/truthy'),
|
|
30
|
-
falsy: require('./matchers/falsy'),
|
|
31
|
-
falsey: require('./matchers/falsy'),
|
|
32
|
-
defined: require('./matchers/IsDefined').defined,
|
|
33
|
-
undefined: require('./matchers/IsDefined').undefined,
|
|
34
|
-
undef: require('./matchers/IsDefined').undefined,
|
|
35
|
-
instanceOf: require('./matchers/IsInstanceOf').instanceOf,
|
|
36
|
-
array: require('./matchers/IsArray').array,
|
|
37
|
-
bool: require('./matchers/IsBoolean').bool,
|
|
38
|
-
boolean: require('./matchers/IsBoolean').bool,
|
|
39
|
-
date: require('./matchers/IsDate').date,
|
|
40
|
-
func: require('./matchers/IsFunction').func,
|
|
41
|
-
number: require('./matchers/IsNumber').number,
|
|
42
|
-
object: require('./matchers/IsObject').object,
|
|
43
|
-
regExp: require('./matchers/IsRegExp').regExp,
|
|
44
|
-
string: require('./matchers/IsString').string,
|
|
45
|
-
containsString: SubstringMatcher.containsString,
|
|
46
|
-
containsStrings: SubstringMatcher.containsStrings,
|
|
47
|
-
startsWith: SubstringMatcher.startsWith,
|
|
48
|
-
endsWith: SubstringMatcher.endsWith,
|
|
49
|
-
matchesPattern: require('./matchers/IsStringMatching').matchesPattern,
|
|
50
|
-
matches: require('./matchers/matches'),
|
|
51
|
-
failsToMatch: require('./matchers/failsToMatch'),
|
|
52
|
-
hasDescription: require('./matchers/hasDescription'),
|
|
53
|
-
lessThan: NumberComparisonMatcher.lessThan,
|
|
54
|
-
lessThanOrEqualTo: NumberComparisonMatcher.lessThanOrEqualTo,
|
|
55
|
-
greaterThan: NumberComparisonMatcher.greaterThan,
|
|
56
|
-
greaterThanOrEqualTo: NumberComparisonMatcher.greaterThanOrEqualTo,
|
|
57
|
-
inRange: require('./matchers/inRange'),
|
|
58
|
-
after: DateComparisonMatcher.after,
|
|
59
|
-
afterOrEqualTo: DateComparisonMatcher.afterOrEqualTo,
|
|
60
|
-
before: DateComparisonMatcher.before,
|
|
61
|
-
beforeOrEqualTo: DateComparisonMatcher.beforeOrEqualTo,
|
|
62
|
-
closeTo: require('./matchers/IsCloseTo').closeTo,
|
|
63
|
-
allOf: require('./matchers/AllOf').allOf,
|
|
64
|
-
anyOf: require('./matchers/AnyOf').anyOf,
|
|
65
|
-
everyItem: require('./matchers/Every').everyItem,
|
|
66
|
-
hasItem: require('./matchers/IsArrayWithItem').hasItem,
|
|
67
|
-
hasItems: require('./matchers/IsArrayWithItems').hasItems,
|
|
68
|
-
hasExactlyOneItem: require('./matchers/hasExactlyOneItem'),
|
|
69
|
-
contains: require('./matchers/IsArrayContaining').contains,
|
|
70
|
-
containsInAnyOrder: require('./matchers/IsArrayContainingInAnyOrder').containsInAnyOrder,
|
|
71
|
-
orderedBy: require('./matchers/IsArrayOrderedBy').orderedBy,
|
|
72
|
-
hasSize: require('./matchers/hasSize'),
|
|
73
|
-
isEmpty: require('./matchers/isEmpty'),
|
|
74
|
-
empty: require('./matchers/isEmpty'),
|
|
75
|
-
hasProperties: require('./matchers/IsObjectWithProperties').hasProperties,
|
|
76
|
-
hasDeepProperties: require('./matchers/IsObjectWithProperties').hasDeepProperties,
|
|
77
|
-
hasProperty: require('./matchers/IsObjectWithProperties').hasProperty,
|
|
78
|
-
throws: require('./matchers/IsFunctionThrowing').throws,
|
|
79
|
-
returns: require('./matchers/returns'),
|
|
80
|
-
typedError: require('./matchers/typedError'),
|
|
81
|
-
promise: require('./matchers/IsPromise').promise,
|
|
82
|
-
fulfilled: require('./matchers/IsFulfilled').fulfilled,
|
|
83
|
-
isFulfilledWith: require('./matchers/IsFulfilled').isFulfilledWith,
|
|
84
|
-
willBe: require('./matchers/IsFulfilled').isFulfilledWith,
|
|
85
|
-
rejected: require('./matchers/IsRejected').rejected,
|
|
86
|
-
isRejectedWith: require('./matchers/IsRejected').isRejectedWith,
|
|
87
|
-
// Deprecated
|
|
88
|
-
promiseAllOf: require('./matchers/AllOf').allOf
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const utils = {
|
|
92
|
-
isMatcher: Matcher.isMatcher,
|
|
93
|
-
asMatcher: require('./utils/asMatcher'),
|
|
94
|
-
acceptingMatcher: require('./utils/acceptingMatcher'),
|
|
95
|
-
Description: Description,
|
|
96
|
-
describe: function (matcher) {
|
|
97
|
-
return new Description()
|
|
98
|
-
.appendDescriptionOf(matcher)
|
|
99
|
-
.get();
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const hamjest = {};
|
|
104
|
-
_.extend(hamjest, asserts, matchers, utils);
|
|
105
|
-
|
|
106
|
-
module.exports = hamjest;
|