@pact-foundation/pact 16.3.1 → 16.4.0
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/CHANGELOG.md +7 -0
- package/CONTRIBUTING.md +2 -2
- package/package.json +16 -24
- package/src/common/graphQL/configurationError.js +2 -22
- package/src/common/graphQL/configurationError.js.map +1 -1
- package/src/common/graphQL/graphQL.d.ts +2 -2
- package/src/common/graphQL/graphQL.js +11 -14
- package/src/common/graphQL/graphQL.js.map +1 -1
- package/src/common/graphQL/graphQLQueryError.js +2 -22
- package/src/common/graphQL/graphQLQueryError.js.map +1 -1
- package/src/common/logger.js +9 -9
- package/src/common/logger.js.map +1 -1
- package/src/common/matchingRules.d.ts +1 -1
- package/src/common/matchingRules.js +21 -21
- package/src/common/matchingRules.js.map +1 -1
- package/src/common/net.js +36 -42
- package/src/common/net.js.map +1 -1
- package/src/common/net.spec.js +41 -53
- package/src/common/net.spec.js.map +1 -1
- package/src/common/request.js +33 -82
- package/src/common/request.js.map +1 -1
- package/src/common/request.spec.js +26 -26
- package/src/common/request.spec.js.map +1 -1
- package/src/common/spec.js +3 -4
- package/src/common/spec.js.map +1 -1
- package/src/dsl/apolloGraphql.js +7 -25
- package/src/dsl/apolloGraphql.js.map +1 -1
- package/src/dsl/apolloGraphql.spec.js +21 -18
- package/src/dsl/apolloGraphql.spec.js.map +1 -1
- package/src/dsl/graphql.d.ts +2 -2
- package/src/dsl/graphql.js +29 -48
- package/src/dsl/graphql.js.map +1 -1
- package/src/dsl/graphql.spec.js +81 -66
- package/src/dsl/graphql.spec.js.map +1 -1
- package/src/dsl/interaction.d.ts +2 -2
- package/src/dsl/interaction.js +41 -48
- package/src/dsl/interaction.js.map +1 -1
- package/src/dsl/interaction.spec.js +77 -70
- package/src/dsl/interaction.spec.js.map +1 -1
- package/src/dsl/matchers.d.ts +1 -1
- package/src/dsl/matchers.js +19 -31
- package/src/dsl/matchers.js.map +1 -1
- package/src/dsl/matchers.spec.js +199 -208
- package/src/dsl/matchers.spec.js.map +1 -1
- package/src/dsl/message.d.ts +3 -3
- package/src/dsl/options.d.ts +3 -3
- package/src/dsl/verifier/proxy/hooks.d.ts +2 -2
- package/src/dsl/verifier/proxy/hooks.js +42 -112
- package/src/dsl/verifier/proxy/hooks.js.map +1 -1
- package/src/dsl/verifier/proxy/hooks.spec.js +84 -199
- package/src/dsl/verifier/proxy/hooks.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/messages.d.ts +2 -2
- package/src/dsl/verifier/proxy/messages.js +88 -106
- package/src/dsl/verifier/proxy/messages.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.d.ts +1 -1
- package/src/dsl/verifier/proxy/parseBody.js +2 -2
- package/src/dsl/verifier/proxy/parseBody.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.spec.js +31 -76
- package/src/dsl/verifier/proxy/parseBody.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.d.ts +2 -2
- package/src/dsl/verifier/proxy/proxy.js +22 -26
- package/src/dsl/verifier/proxy/proxy.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.spec.js +14 -14
- package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.d.ts +3 -3
- package/src/dsl/verifier/proxy/proxyRequest.js +7 -7
- package/src/dsl/verifier/proxy/proxyRequest.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.spec.js +49 -64
- package/src/dsl/verifier/proxy/proxyRequest.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.d.ts +3 -3
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js +14 -18
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +76 -159
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.d.ts +2 -2
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +23 -72
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +37 -85
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/tracer.d.ts +1 -1
- package/src/dsl/verifier/proxy/tracer.js +42 -35
- package/src/dsl/verifier/proxy/tracer.js.map +1 -1
- package/src/dsl/verifier/proxy/types.d.ts +5 -5
- package/src/dsl/verifier/types.d.ts +3 -3
- package/src/dsl/verifier/verifier.d.ts +1 -1
- package/src/dsl/verifier/verifier.js +49 -56
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/dsl/verifier/verifier.spec.js +76 -93
- package/src/dsl/verifier/verifier.spec.js.map +1 -1
- package/src/errors/configurationError.js +2 -22
- package/src/errors/configurationError.js.map +1 -1
- package/src/errors/graphQLQueryError.js +2 -22
- package/src/errors/graphQLQueryError.js.map +1 -1
- package/src/errors/matcherError.js +2 -22
- package/src/errors/matcherError.js.map +1 -1
- package/src/errors/verificationError.js +2 -22
- package/src/errors/verificationError.js.map +1 -1
- package/src/httpPact/ffi.d.ts +2 -2
- package/src/httpPact/ffi.js +28 -29
- package/src/httpPact/ffi.js.map +1 -1
- package/src/httpPact/ffi.spec.js +30 -31
- package/src/httpPact/ffi.spec.js.map +1 -1
- package/src/httpPact/index.d.ts +3 -3
- package/src/httpPact/index.js +92 -149
- package/src/httpPact/index.js.map +1 -1
- package/src/httpPact/index.spec.js +75 -125
- package/src/httpPact/index.spec.js.map +1 -1
- package/src/httpPact/tracing.js +20 -28
- package/src/httpPact/tracing.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/messageConsumerPact.d.ts +3 -3
- package/src/messageConsumerPact.js +50 -51
- package/src/messageConsumerPact.js.map +1 -1
- package/src/messageConsumerPact.spec.js +50 -49
- package/src/messageConsumerPact.spec.js.map +1 -1
- package/src/messageProviderPact.d.ts +3 -3
- package/src/messageProviderPact.js +68 -85
- package/src/messageProviderPact.js.map +1 -1
- package/src/messageProviderPact.spec.js +75 -66
- package/src/messageProviderPact.spec.js.map +1 -1
- package/src/pact.integration.spec.js +243 -313
- package/src/pact.integration.spec.js.map +1 -1
- package/src/v3/display.d.ts +1 -1
- package/src/v3/display.js +44 -58
- package/src/v3/display.js.map +1 -1
- package/src/v3/ffi.js +15 -15
- package/src/v3/ffi.js.map +1 -1
- package/src/v3/ffi.spec.js +8 -8
- package/src/v3/ffi.spec.js.map +1 -1
- package/src/v3/graphql/graphQL.d.ts +4 -4
- package/src/v3/graphql/graphQL.js +50 -75
- package/src/v3/graphql/graphQL.js.map +1 -1
- package/src/v3/matchers.d.ts +2 -2
- package/src/v3/matchers.js +112 -147
- package/src/v3/matchers.js.map +1 -1
- package/src/v3/matchers.spec.js +168 -187
- package/src/v3/matchers.spec.js.map +1 -1
- package/src/v3/pact.d.ts +2 -2
- package/src/v3/pact.js +103 -151
- package/src/v3/pact.js.map +1 -1
- package/src/v3/types.d.ts +1 -1
- package/src/v3/xml/xmlBuilder.d.ts +1 -3
- package/src/v3/xml/xmlBuilder.js +7 -9
- package/src/v3/xml/xmlBuilder.js.map +1 -1
- package/src/v3/xml/xmlElement.d.ts +2 -2
- package/src/v3/xml/xmlElement.js +24 -41
- package/src/v3/xml/xmlElement.js.map +1 -1
- package/src/v3/xml/xmlElement.spec.js +23 -25
- package/src/v3/xml/xmlElement.spec.js.map +1 -1
- package/src/v3/xml/xmlNode.js +2 -5
- package/src/v3/xml/xmlNode.js.map +1 -1
- package/src/v3/xml/xmlText.d.ts +1 -1
- package/src/v3/xml/xmlText.js +9 -25
- package/src/v3/xml/xmlText.js.map +1 -1
- package/src/v4/graphql/graphQLInteractionWithRequest.d.ts +4 -4
- package/src/v4/graphql/graphQLInteractionWithRequest.js +21 -17
- package/src/v4/graphql/graphQLInteractionWithRequest.js.map +1 -1
- package/src/v4/graphql/graphQLRequestBuilder.d.ts +3 -3
- package/src/v4/graphql/graphQLRequestBuilder.js +18 -20
- package/src/v4/graphql/graphQLRequestBuilder.js.map +1 -1
- package/src/v4/graphql/index.d.ts +6 -6
- package/src/v4/graphql/index.js +21 -17
- package/src/v4/graphql/index.js.map +1 -1
- package/src/v4/graphql/types.d.ts +5 -5
- package/src/v4/http/index.d.ts +2 -2
- package/src/v4/http/index.js +48 -93
- package/src/v4/http/index.js.map +1 -1
- package/src/v4/http/interactionWithCompleteRequest.d.ts +4 -7
- package/src/v4/http/interactionWithCompleteRequest.js +6 -10
- package/src/v4/http/interactionWithCompleteRequest.js.map +1 -1
- package/src/v4/http/interactionWithPlugin.d.ts +3 -3
- package/src/v4/http/interactionWithPlugin.js +14 -11
- package/src/v4/http/interactionWithPlugin.js.map +1 -1
- package/src/v4/http/interactionWithPluginRequest.d.ts +2 -2
- package/src/v4/http/interactionWithPluginRequest.js +11 -8
- package/src/v4/http/interactionWithPluginRequest.js.map +1 -1
- package/src/v4/http/interactionWithPluginResponse.d.ts +2 -2
- package/src/v4/http/interactionWithPluginResponse.js +10 -48
- package/src/v4/http/interactionWithPluginResponse.js.map +1 -1
- package/src/v4/http/interactionWithRequest.d.ts +2 -2
- package/src/v4/http/interactionWithRequest.js +11 -8
- package/src/v4/http/interactionWithRequest.js.map +1 -1
- package/src/v4/http/interactionWithResponse.d.ts +2 -2
- package/src/v4/http/interactionWithResponse.js +10 -48
- package/src/v4/http/interactionWithResponse.js.map +1 -1
- package/src/v4/http/requestBuilder.d.ts +3 -3
- package/src/v4/http/requestBuilder.js +32 -34
- package/src/v4/http/requestBuilder.js.map +1 -1
- package/src/v4/http/requestWithPluginBuilder.d.ts +2 -2
- package/src/v4/http/requestWithPluginBuilder.js +26 -46
- package/src/v4/http/requestWithPluginBuilder.js.map +1 -1
- package/src/v4/http/responseBuilder.d.ts +3 -3
- package/src/v4/http/responseBuilder.js +24 -25
- package/src/v4/http/responseBuilder.js.map +1 -1
- package/src/v4/http/responseWithPluginBuilder.d.ts +1 -1
- package/src/v4/http/responseWithPluginBuilder.js +5 -25
- package/src/v4/http/responseWithPluginBuilder.js.map +1 -1
- package/src/v4/http/types.d.ts +3 -2
- package/src/v4/http/unconfiguredInteraction.d.ts +6 -5
- package/src/v4/http/unconfiguredInteraction.js +31 -26
- package/src/v4/http/unconfiguredInteraction.js.map +1 -1
- package/src/v4/index.d.ts +4 -4
- package/src/v4/index.js +31 -35
- package/src/v4/index.js.map +1 -1
- package/src/v4/message/asynchronousMessage.d.ts +7 -6
- package/src/v4/message/asynchronousMessage.js +157 -190
- package/src/v4/message/asynchronousMessage.js.map +1 -1
- package/src/v4/message/index.d.ts +7 -6
- package/src/v4/message/index.js +188 -217
- package/src/v4/message/index.js.map +1 -1
- package/src/v4/message/types.d.ts +5 -3
- package/src/v4/types.d.ts +3 -3
package/src/v3/matchers.spec.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -44,24 +33,24 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
33
|
};
|
|
45
34
|
})();
|
|
46
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
describe('V3 Matchers',
|
|
51
|
-
it('compiles with nested examples from issue 1054',
|
|
52
|
-
|
|
36
|
+
const chai = __importStar(require("chai"));
|
|
37
|
+
const MatchersV3 = __importStar(require("./matchers"));
|
|
38
|
+
const { expect } = chai;
|
|
39
|
+
describe('V3 Matchers', () => {
|
|
40
|
+
it('compiles with nested examples from issue 1054', () => {
|
|
41
|
+
const f = { a: 'working example' };
|
|
53
42
|
MatchersV3.like(f);
|
|
54
|
-
MatchersV3.like(
|
|
43
|
+
MatchersV3.like({ ...f });
|
|
55
44
|
MatchersV3.like(Object.freeze(f));
|
|
56
|
-
|
|
45
|
+
const r = { id: 'some guid', foo: { a: 'example' } };
|
|
57
46
|
MatchersV3.like(r);
|
|
58
|
-
MatchersV3.like(
|
|
47
|
+
MatchersV3.like({ ...r });
|
|
59
48
|
MatchersV3.like(Object.freeze(f));
|
|
60
49
|
MatchersV3.reify(r);
|
|
61
50
|
});
|
|
62
|
-
describe('#like',
|
|
63
|
-
it('returns a JSON representation of a like matcher',
|
|
64
|
-
|
|
51
|
+
describe('#like', () => {
|
|
52
|
+
it('returns a JSON representation of a like matcher', () => {
|
|
53
|
+
const result = MatchersV3.like({
|
|
65
54
|
a: 'b',
|
|
66
55
|
});
|
|
67
56
|
expect(result).to.deep.equal({
|
|
@@ -72,9 +61,9 @@ describe('V3 Matchers', function () {
|
|
|
72
61
|
});
|
|
73
62
|
});
|
|
74
63
|
});
|
|
75
|
-
describe('#eachKeylike',
|
|
76
|
-
it('returns a JSON representation of an eachKeyLike matcher',
|
|
77
|
-
|
|
64
|
+
describe('#eachKeylike', () => {
|
|
65
|
+
it('returns a JSON representation of an eachKeyLike matcher', () => {
|
|
66
|
+
const result = MatchersV3.eachKeyLike('004', {
|
|
78
67
|
id: '004',
|
|
79
68
|
});
|
|
80
69
|
expect(result).to.deep.equal({
|
|
@@ -87,10 +76,10 @@ describe('V3 Matchers', function () {
|
|
|
87
76
|
});
|
|
88
77
|
});
|
|
89
78
|
});
|
|
90
|
-
describe('#eachLike',
|
|
91
|
-
describe('with no min',
|
|
92
|
-
it('returns a JSON representation of an eachLike matcher',
|
|
93
|
-
|
|
79
|
+
describe('#eachLike', () => {
|
|
80
|
+
describe('with no min', () => {
|
|
81
|
+
it('returns a JSON representation of an eachLike matcher', () => {
|
|
82
|
+
const result = MatchersV3.eachLike({
|
|
94
83
|
a: 'b',
|
|
95
84
|
});
|
|
96
85
|
expect(result).to.deep.equal({
|
|
@@ -104,9 +93,9 @@ describe('V3 Matchers', function () {
|
|
|
104
93
|
});
|
|
105
94
|
});
|
|
106
95
|
});
|
|
107
|
-
describe('with min',
|
|
108
|
-
it('returns a JSON representation of an eachLike matcher',
|
|
109
|
-
|
|
96
|
+
describe('with min', () => {
|
|
97
|
+
it('returns a JSON representation of an eachLike matcher', () => {
|
|
98
|
+
const result = MatchersV3.eachLike({
|
|
110
99
|
a: 'b',
|
|
111
100
|
}, 3);
|
|
112
101
|
expect(result).to.deep.equal({
|
|
@@ -127,10 +116,10 @@ describe('V3 Matchers', function () {
|
|
|
127
116
|
});
|
|
128
117
|
});
|
|
129
118
|
});
|
|
130
|
-
describe('#atLeastOneLike',
|
|
131
|
-
describe('with no examples',
|
|
132
|
-
it('returns a JSON representation of an atLeastOneLike matcher',
|
|
133
|
-
|
|
119
|
+
describe('#atLeastOneLike', () => {
|
|
120
|
+
describe('with no examples', () => {
|
|
121
|
+
it('returns a JSON representation of an atLeastOneLike matcher', () => {
|
|
122
|
+
const result = MatchersV3.atLeastOneLike({
|
|
134
123
|
a: 'b',
|
|
135
124
|
});
|
|
136
125
|
expect(result).to.deep.equal({
|
|
@@ -144,9 +133,9 @@ describe('V3 Matchers', function () {
|
|
|
144
133
|
});
|
|
145
134
|
});
|
|
146
135
|
});
|
|
147
|
-
describe('when provided examples',
|
|
148
|
-
it('returns a JSON representation of an atLeastOneLike matcher with the correct number of examples',
|
|
149
|
-
|
|
136
|
+
describe('when provided examples', () => {
|
|
137
|
+
it('returns a JSON representation of an atLeastOneLike matcher with the correct number of examples', () => {
|
|
138
|
+
const result = MatchersV3.atLeastOneLike({
|
|
150
139
|
a: 'b',
|
|
151
140
|
}, 4);
|
|
152
141
|
expect(result).to.deep.equal({
|
|
@@ -157,10 +146,10 @@ describe('V3 Matchers', function () {
|
|
|
157
146
|
});
|
|
158
147
|
});
|
|
159
148
|
});
|
|
160
|
-
describe('#atLeastLike',
|
|
161
|
-
describe('with no examples',
|
|
162
|
-
it('returns a JSON representation of an atLeastLike matcher',
|
|
163
|
-
|
|
149
|
+
describe('#atLeastLike', () => {
|
|
150
|
+
describe('with no examples', () => {
|
|
151
|
+
it('returns a JSON representation of an atLeastLike matcher', () => {
|
|
152
|
+
const result = MatchersV3.atLeastLike({
|
|
164
153
|
a: 'b',
|
|
165
154
|
}, 2);
|
|
166
155
|
expect(result).to.deep.equal({
|
|
@@ -170,9 +159,9 @@ describe('V3 Matchers', function () {
|
|
|
170
159
|
});
|
|
171
160
|
});
|
|
172
161
|
});
|
|
173
|
-
describe('when provided examples',
|
|
174
|
-
it('returns a JSON representation of an atLeastLike matcher with the correct number of examples',
|
|
175
|
-
|
|
162
|
+
describe('when provided examples', () => {
|
|
163
|
+
it('returns a JSON representation of an atLeastLike matcher with the correct number of examples', () => {
|
|
164
|
+
const result = MatchersV3.atLeastLike({
|
|
176
165
|
a: 'b',
|
|
177
166
|
}, 2, 4);
|
|
178
167
|
expect(result).to.deep.equal({
|
|
@@ -182,14 +171,14 @@ describe('V3 Matchers', function () {
|
|
|
182
171
|
});
|
|
183
172
|
});
|
|
184
173
|
});
|
|
185
|
-
it('throws an error if the number of examples is less than the minimum',
|
|
186
|
-
expect(
|
|
174
|
+
it('throws an error if the number of examples is less than the minimum', () => {
|
|
175
|
+
expect(() => MatchersV3.atLeastLike({ a: 'b' }, 4, 2)).to.throw('atLeastLike has a minimum of 4 but 2 elements were requested. Make sure the count is greater than or equal to the min.');
|
|
187
176
|
});
|
|
188
177
|
});
|
|
189
|
-
describe('#atMostLike',
|
|
190
|
-
describe('with no examples',
|
|
191
|
-
it('returns a JSON representation of an atMostLike matcher',
|
|
192
|
-
|
|
178
|
+
describe('#atMostLike', () => {
|
|
179
|
+
describe('with no examples', () => {
|
|
180
|
+
it('returns a JSON representation of an atMostLike matcher', () => {
|
|
181
|
+
const result = MatchersV3.atMostLike({
|
|
193
182
|
a: 'b',
|
|
194
183
|
}, 2);
|
|
195
184
|
expect(result).to.deep.equal({
|
|
@@ -199,9 +188,9 @@ describe('V3 Matchers', function () {
|
|
|
199
188
|
});
|
|
200
189
|
});
|
|
201
190
|
});
|
|
202
|
-
describe('when provided examples',
|
|
203
|
-
it('returns a JSON representation of an atMostLike matcher with the correct number of examples',
|
|
204
|
-
|
|
191
|
+
describe('when provided examples', () => {
|
|
192
|
+
it('returns a JSON representation of an atMostLike matcher with the correct number of examples', () => {
|
|
193
|
+
const result = MatchersV3.atMostLike({
|
|
205
194
|
a: 'b',
|
|
206
195
|
}, 4, 4);
|
|
207
196
|
expect(result).to.deep.equal({
|
|
@@ -211,14 +200,14 @@ describe('V3 Matchers', function () {
|
|
|
211
200
|
});
|
|
212
201
|
});
|
|
213
202
|
});
|
|
214
|
-
it('throws an error if the number of examples is more than the maximum',
|
|
215
|
-
expect(
|
|
203
|
+
it('throws an error if the number of examples is more than the maximum', () => {
|
|
204
|
+
expect(() => MatchersV3.atMostLike({ a: 'b' }, 2, 4)).to.throw('atMostLike has a maximum of 2 but 4 elements where requested. Make sure the count is less than or equal to the max.');
|
|
216
205
|
});
|
|
217
206
|
});
|
|
218
|
-
describe('#constrainedArrayLike',
|
|
219
|
-
describe('with no examples',
|
|
220
|
-
it('returns a JSON representation of an constrainedArrayLike matcher',
|
|
221
|
-
|
|
207
|
+
describe('#constrainedArrayLike', () => {
|
|
208
|
+
describe('with no examples', () => {
|
|
209
|
+
it('returns a JSON representation of an constrainedArrayLike matcher', () => {
|
|
210
|
+
const result = MatchersV3.constrainedArrayLike({
|
|
222
211
|
a: 'b',
|
|
223
212
|
}, 2, 4);
|
|
224
213
|
expect(result).to.deep.equal({
|
|
@@ -229,9 +218,9 @@ describe('V3 Matchers', function () {
|
|
|
229
218
|
});
|
|
230
219
|
});
|
|
231
220
|
});
|
|
232
|
-
describe('when provided examples',
|
|
233
|
-
it('returns a JSON representation of an constrainedArrayLike matcher with the correct number of examples',
|
|
234
|
-
|
|
221
|
+
describe('when provided examples', () => {
|
|
222
|
+
it('returns a JSON representation of an constrainedArrayLike matcher with the correct number of examples', () => {
|
|
223
|
+
const result = MatchersV3.constrainedArrayLike({
|
|
235
224
|
a: 'b',
|
|
236
225
|
}, 2, 4, 3);
|
|
237
226
|
expect(result).to.deep.equal({
|
|
@@ -242,37 +231,33 @@ describe('V3 Matchers', function () {
|
|
|
242
231
|
});
|
|
243
232
|
});
|
|
244
233
|
});
|
|
245
|
-
it('throws an error if the number of examples is less than the minimum',
|
|
246
|
-
expect(
|
|
247
|
-
return MatchersV3.constrainedArrayLike({ a: 'b' }, 4, 6, 2);
|
|
248
|
-
}).to.throw('constrainedArrayLike has a minimum of 4 but 2 elements where requested. Make sure the count is greater than or equal to the min.');
|
|
234
|
+
it('throws an error if the number of examples is less than the minimum', () => {
|
|
235
|
+
expect(() => MatchersV3.constrainedArrayLike({ a: 'b' }, 4, 6, 2)).to.throw('constrainedArrayLike has a minimum of 4 but 2 elements where requested. Make sure the count is greater than or equal to the min.');
|
|
249
236
|
});
|
|
250
|
-
it('throws an error if the number of examples is more than the maximum',
|
|
251
|
-
expect(
|
|
252
|
-
return MatchersV3.constrainedArrayLike({ a: 'b' }, 4, 6, 8);
|
|
253
|
-
}).to.throw('constrainedArrayLike has a maximum of 6 but 8 elements where requested. Make sure the count is less than or equal to the max.');
|
|
237
|
+
it('throws an error if the number of examples is more than the maximum', () => {
|
|
238
|
+
expect(() => MatchersV3.constrainedArrayLike({ a: 'b' }, 4, 6, 8)).to.throw('constrainedArrayLike has a maximum of 6 but 8 elements where requested. Make sure the count is less than or equal to the max.');
|
|
254
239
|
});
|
|
255
240
|
});
|
|
256
|
-
describe('#integer',
|
|
257
|
-
it('returns a JSON representation of an integer matcher',
|
|
258
|
-
|
|
241
|
+
describe('#integer', () => {
|
|
242
|
+
it('returns a JSON representation of an integer matcher', () => {
|
|
243
|
+
const result = MatchersV3.integer(100);
|
|
259
244
|
expect(result).to.deep.equal({
|
|
260
245
|
'pact:matcher:type': 'integer',
|
|
261
246
|
value: 100,
|
|
262
247
|
});
|
|
263
248
|
});
|
|
264
|
-
describe('when the example is zero',
|
|
265
|
-
it('returns a JSON representation of an integer matcher',
|
|
266
|
-
|
|
249
|
+
describe('when the example is zero', () => {
|
|
250
|
+
it('returns a JSON representation of an integer matcher', () => {
|
|
251
|
+
const result = MatchersV3.integer(0);
|
|
267
252
|
expect(result).to.deep.equal({
|
|
268
253
|
'pact:matcher:type': 'integer',
|
|
269
254
|
value: 0,
|
|
270
255
|
});
|
|
271
256
|
});
|
|
272
257
|
});
|
|
273
|
-
describe('when no example is given',
|
|
274
|
-
it('also includes a random integer generator',
|
|
275
|
-
|
|
258
|
+
describe('when no example is given', () => {
|
|
259
|
+
it('also includes a random integer generator', () => {
|
|
260
|
+
const result = MatchersV3.integer();
|
|
276
261
|
expect(result).to.deep.equal({
|
|
277
262
|
'pact:matcher:type': 'integer',
|
|
278
263
|
'pact:generator:type': 'RandomInt',
|
|
@@ -281,26 +266,26 @@ describe('V3 Matchers', function () {
|
|
|
281
266
|
});
|
|
282
267
|
});
|
|
283
268
|
});
|
|
284
|
-
describe('#decimal',
|
|
285
|
-
it('returns a JSON representation of an decimal matcher',
|
|
286
|
-
|
|
269
|
+
describe('#decimal', () => {
|
|
270
|
+
it('returns a JSON representation of an decimal matcher', () => {
|
|
271
|
+
const result = MatchersV3.decimal(100.3);
|
|
287
272
|
expect(result).to.deep.equal({
|
|
288
273
|
'pact:matcher:type': 'decimal',
|
|
289
274
|
value: 100.3,
|
|
290
275
|
});
|
|
291
276
|
});
|
|
292
|
-
describe('when the example is zero',
|
|
293
|
-
it('returns a JSON representation of an integer matcher',
|
|
294
|
-
|
|
277
|
+
describe('when the example is zero', () => {
|
|
278
|
+
it('returns a JSON representation of an integer matcher', () => {
|
|
279
|
+
const result = MatchersV3.decimal(0.0);
|
|
295
280
|
expect(result).to.deep.equal({
|
|
296
281
|
'pact:matcher:type': 'decimal',
|
|
297
282
|
value: 0.0,
|
|
298
283
|
});
|
|
299
284
|
});
|
|
300
285
|
});
|
|
301
|
-
describe('when no example is given',
|
|
302
|
-
it('also includes a random decimal generator',
|
|
303
|
-
|
|
286
|
+
describe('when no example is given', () => {
|
|
287
|
+
it('also includes a random decimal generator', () => {
|
|
288
|
+
const result = MatchersV3.decimal();
|
|
304
289
|
expect(result).to.deep.equal({
|
|
305
290
|
'pact:matcher:type': 'decimal',
|
|
306
291
|
'pact:generator:type': 'RandomDecimal',
|
|
@@ -309,17 +294,17 @@ describe('V3 Matchers', function () {
|
|
|
309
294
|
});
|
|
310
295
|
});
|
|
311
296
|
});
|
|
312
|
-
describe('#number',
|
|
313
|
-
it('returns a JSON representation of an number matcher',
|
|
314
|
-
|
|
297
|
+
describe('#number', () => {
|
|
298
|
+
it('returns a JSON representation of an number matcher', () => {
|
|
299
|
+
const result = MatchersV3.number(100.3);
|
|
315
300
|
expect(result).to.deep.equal({
|
|
316
301
|
'pact:matcher:type': 'number',
|
|
317
302
|
value: 100.3,
|
|
318
303
|
});
|
|
319
304
|
});
|
|
320
|
-
describe('when no example is given',
|
|
321
|
-
it('also includes a random integer generator',
|
|
322
|
-
|
|
305
|
+
describe('when no example is given', () => {
|
|
306
|
+
it('also includes a random integer generator', () => {
|
|
307
|
+
const result = MatchersV3.number();
|
|
323
308
|
expect(result).to.deep.equal({
|
|
324
309
|
'pact:matcher:type': 'number',
|
|
325
310
|
'pact:generator:type': 'RandomInt',
|
|
@@ -328,36 +313,36 @@ describe('V3 Matchers', function () {
|
|
|
328
313
|
});
|
|
329
314
|
});
|
|
330
315
|
});
|
|
331
|
-
describe('#boolean',
|
|
332
|
-
it('returns a JSON representation of a like matcher',
|
|
333
|
-
|
|
316
|
+
describe('#boolean', () => {
|
|
317
|
+
it('returns a JSON representation of a like matcher', () => {
|
|
318
|
+
const result = MatchersV3.boolean(true);
|
|
334
319
|
expect(result).to.deep.equal({
|
|
335
320
|
'pact:matcher:type': 'type',
|
|
336
321
|
value: true,
|
|
337
322
|
});
|
|
338
323
|
});
|
|
339
324
|
});
|
|
340
|
-
describe('#string',
|
|
341
|
-
it('returns a JSON representation of a like matcher',
|
|
342
|
-
|
|
325
|
+
describe('#string', () => {
|
|
326
|
+
it('returns a JSON representation of a like matcher', () => {
|
|
327
|
+
const result = MatchersV3.string('true');
|
|
343
328
|
expect(result).to.deep.equal({
|
|
344
329
|
'pact:matcher:type': 'type',
|
|
345
330
|
value: 'true',
|
|
346
331
|
});
|
|
347
332
|
});
|
|
348
333
|
});
|
|
349
|
-
describe('#regex',
|
|
350
|
-
it('returns a JSON representation of a regex matcher',
|
|
351
|
-
|
|
334
|
+
describe('#regex', () => {
|
|
335
|
+
it('returns a JSON representation of a regex matcher', () => {
|
|
336
|
+
const result = MatchersV3.regex('\\d+', '1234');
|
|
352
337
|
expect(result).to.deep.equal({
|
|
353
338
|
'pact:matcher:type': 'regex',
|
|
354
339
|
regex: '\\d+',
|
|
355
340
|
value: '1234',
|
|
356
341
|
});
|
|
357
342
|
});
|
|
358
|
-
describe('when given a regular expression',
|
|
359
|
-
it('returns a JSON representation of a regex matcher',
|
|
360
|
-
|
|
343
|
+
describe('when given a regular expression', () => {
|
|
344
|
+
it('returns a JSON representation of a regex matcher', () => {
|
|
345
|
+
const result = MatchersV3.regex(/\d+/, '1234');
|
|
361
346
|
expect(result).to.deep.equal({
|
|
362
347
|
'pact:matcher:type': 'regex',
|
|
363
348
|
regex: '\\d+',
|
|
@@ -366,19 +351,19 @@ describe('V3 Matchers', function () {
|
|
|
366
351
|
});
|
|
367
352
|
});
|
|
368
353
|
});
|
|
369
|
-
describe('#equal',
|
|
370
|
-
it('returns a JSON representation of an equality matcher',
|
|
371
|
-
|
|
354
|
+
describe('#equal', () => {
|
|
355
|
+
it('returns a JSON representation of an equality matcher', () => {
|
|
356
|
+
const result = MatchersV3.equal('true');
|
|
372
357
|
expect(result).to.deep.equal({
|
|
373
358
|
'pact:matcher:type': 'equality',
|
|
374
359
|
value: 'true',
|
|
375
360
|
});
|
|
376
361
|
});
|
|
377
362
|
});
|
|
378
|
-
describe('#datetime',
|
|
379
|
-
describe('when an example is given',
|
|
380
|
-
it('returns a JSON representation of a datetime matcher',
|
|
381
|
-
|
|
363
|
+
describe('#datetime', () => {
|
|
364
|
+
describe('when an example is given', () => {
|
|
365
|
+
it('returns a JSON representation of a datetime matcher', () => {
|
|
366
|
+
const result = MatchersV3.datetime("yyyy-MM-dd'T'HH:mm:ss.SSSX", '2016-02-11T09:46:56.023Z');
|
|
382
367
|
expect(result).to.deep.equal({
|
|
383
368
|
'pact:matcher:type': 'timestamp',
|
|
384
369
|
format: "yyyy-MM-dd'T'HH:mm:ss.SSSX",
|
|
@@ -386,18 +371,16 @@ describe('V3 Matchers', function () {
|
|
|
386
371
|
});
|
|
387
372
|
});
|
|
388
373
|
});
|
|
389
|
-
describe('when example is an empty string',
|
|
390
|
-
it('throws an error',
|
|
391
|
-
expect(
|
|
392
|
-
return MatchersV3.datetime("yyyy-MM-dd'T'HH:mm:ss.SSSX", '');
|
|
393
|
-
}).to.throw('you must provide an example datetime');
|
|
374
|
+
describe('when example is an empty string', () => {
|
|
375
|
+
it('throws an error', () => {
|
|
376
|
+
expect(() => MatchersV3.datetime("yyyy-MM-dd'T'HH:mm:ss.SSSX", '')).to.throw('you must provide an example datetime');
|
|
394
377
|
});
|
|
395
378
|
});
|
|
396
379
|
});
|
|
397
|
-
describe('#time',
|
|
398
|
-
describe('when an example is given',
|
|
399
|
-
it('returns a JSON representation of a time matcher',
|
|
400
|
-
|
|
380
|
+
describe('#time', () => {
|
|
381
|
+
describe('when an example is given', () => {
|
|
382
|
+
it('returns a JSON representation of a time matcher', () => {
|
|
383
|
+
const result = MatchersV3.time('HH:mm:ss', '09:46:56');
|
|
401
384
|
expect(result).to.deep.equal({
|
|
402
385
|
'pact:matcher:type': 'time',
|
|
403
386
|
format: 'HH:mm:ss',
|
|
@@ -405,16 +388,16 @@ describe('V3 Matchers', function () {
|
|
|
405
388
|
});
|
|
406
389
|
});
|
|
407
390
|
});
|
|
408
|
-
describe('when example is an empty string',
|
|
409
|
-
it('throws an error',
|
|
410
|
-
expect(
|
|
391
|
+
describe('when example is an empty string', () => {
|
|
392
|
+
it('throws an error', () => {
|
|
393
|
+
expect(() => MatchersV3.time('HH:mm:ss', '')).to.throw('you must provide an example time');
|
|
411
394
|
});
|
|
412
395
|
});
|
|
413
396
|
});
|
|
414
|
-
describe('#date',
|
|
415
|
-
describe('when an example is given',
|
|
416
|
-
it('returns a JSON representation of a date matcher',
|
|
417
|
-
|
|
397
|
+
describe('#date', () => {
|
|
398
|
+
describe('when an example is given', () => {
|
|
399
|
+
it('returns a JSON representation of a date matcher', () => {
|
|
400
|
+
const result = MatchersV3.date('yyyy-MM-dd', '2016-02-11');
|
|
418
401
|
expect(result).to.deep.equal({
|
|
419
402
|
'pact:matcher:type': 'date',
|
|
420
403
|
format: 'yyyy-MM-dd',
|
|
@@ -422,33 +405,33 @@ describe('V3 Matchers', function () {
|
|
|
422
405
|
});
|
|
423
406
|
});
|
|
424
407
|
});
|
|
425
|
-
describe('when example is an empty string',
|
|
426
|
-
it('throws an error',
|
|
427
|
-
expect(
|
|
408
|
+
describe('when example is an empty string', () => {
|
|
409
|
+
it('throws an error', () => {
|
|
410
|
+
expect(() => MatchersV3.date('yyyy-MM-dd', '')).to.throw('you must provide an example date');
|
|
428
411
|
});
|
|
429
412
|
});
|
|
430
413
|
});
|
|
431
|
-
describe('#includes',
|
|
432
|
-
it('returns a JSON representation of an include matcher',
|
|
433
|
-
|
|
414
|
+
describe('#includes', () => {
|
|
415
|
+
it('returns a JSON representation of an include matcher', () => {
|
|
416
|
+
const result = MatchersV3.includes('true');
|
|
434
417
|
expect(result).to.deep.equal({
|
|
435
418
|
'pact:matcher:type': 'include',
|
|
436
419
|
value: 'true',
|
|
437
420
|
});
|
|
438
421
|
});
|
|
439
422
|
});
|
|
440
|
-
describe('#nullValue',
|
|
441
|
-
it('returns a JSON representation of an null matcher',
|
|
442
|
-
|
|
423
|
+
describe('#nullValue', () => {
|
|
424
|
+
it('returns a JSON representation of an null matcher', () => {
|
|
425
|
+
const result = MatchersV3.nullValue();
|
|
443
426
|
expect(result).to.deep.equal({
|
|
444
427
|
'pact:matcher:type': 'null',
|
|
445
428
|
value: null,
|
|
446
429
|
});
|
|
447
430
|
});
|
|
448
431
|
});
|
|
449
|
-
describe('#url',
|
|
450
|
-
it('returns a JSON representation of a regex matcher for the URL',
|
|
451
|
-
|
|
432
|
+
describe('#url', () => {
|
|
433
|
+
it('returns a JSON representation of a regex matcher for the URL', () => {
|
|
434
|
+
const result = MatchersV3.url2('http://localhost:8080', [
|
|
452
435
|
'users',
|
|
453
436
|
'1234',
|
|
454
437
|
'posts',
|
|
@@ -460,9 +443,9 @@ describe('V3 Matchers', function () {
|
|
|
460
443
|
value: 'http://localhost:8080/users/1234/posts/latest',
|
|
461
444
|
});
|
|
462
445
|
});
|
|
463
|
-
describe('when provided with a regex matcher',
|
|
464
|
-
it('returns a JSON representation of a regex matcher for the URL',
|
|
465
|
-
|
|
446
|
+
describe('when provided with a regex matcher', () => {
|
|
447
|
+
it('returns a JSON representation of a regex matcher for the URL', () => {
|
|
448
|
+
const result = MatchersV3.url2('http://localhost:8080', [
|
|
466
449
|
'users',
|
|
467
450
|
MatchersV3.regex('\\d+', '1234'),
|
|
468
451
|
'posts',
|
|
@@ -475,9 +458,9 @@ describe('V3 Matchers', function () {
|
|
|
475
458
|
});
|
|
476
459
|
});
|
|
477
460
|
});
|
|
478
|
-
describe('when provided with a regular expression',
|
|
479
|
-
it('returns a JSON representation of a regex matcher for the URL',
|
|
480
|
-
|
|
461
|
+
describe('when provided with a regular expression', () => {
|
|
462
|
+
it('returns a JSON representation of a regex matcher for the URL', () => {
|
|
463
|
+
const result = MatchersV3.url2('http://localhost:8080', [
|
|
481
464
|
'users',
|
|
482
465
|
/\d+/,
|
|
483
466
|
'posts',
|
|
@@ -490,9 +473,9 @@ describe('V3 Matchers', function () {
|
|
|
490
473
|
expect(result.value).to.match(/\/users\/\d+\/posts\/latest$/);
|
|
491
474
|
});
|
|
492
475
|
});
|
|
493
|
-
describe('when no base URL is provided',
|
|
494
|
-
it('returns regex matcher and a MockServerURL generator',
|
|
495
|
-
|
|
476
|
+
describe('when no base URL is provided', () => {
|
|
477
|
+
it('returns regex matcher and a MockServerURL generator', () => {
|
|
478
|
+
const result = MatchersV3.url([
|
|
496
479
|
'users',
|
|
497
480
|
MatchersV3.regex('\\d+', '1234'),
|
|
498
481
|
'posts',
|
|
@@ -508,24 +491,22 @@ describe('V3 Matchers', function () {
|
|
|
508
491
|
});
|
|
509
492
|
});
|
|
510
493
|
});
|
|
511
|
-
describe('#uuid',
|
|
512
|
-
it('returns a JSON representation of an regex matcher for UUIDs',
|
|
513
|
-
|
|
494
|
+
describe('#uuid', () => {
|
|
495
|
+
it('returns a JSON representation of an regex matcher for UUIDs', () => {
|
|
496
|
+
const result = MatchersV3.uuid('ba4bd1bc-5556-11eb-9286-d71bc5b507be');
|
|
514
497
|
expect(result).to.deep.equal({
|
|
515
498
|
'pact:matcher:type': 'regex',
|
|
516
499
|
regex: '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
|
|
517
500
|
value: 'ba4bd1bc-5556-11eb-9286-d71bc5b507be',
|
|
518
501
|
});
|
|
519
502
|
});
|
|
520
|
-
it('throws an exception if the example value does not match the UUID regex',
|
|
521
|
-
expect(
|
|
522
|
-
expect(
|
|
523
|
-
expect(
|
|
524
|
-
return MatchersV3.uuid('ba4bd1bc-5556-11eb-9286-d71bc5b507be-1234');
|
|
525
|
-
}).to.throw();
|
|
503
|
+
it('throws an exception if the example value does not match the UUID regex', () => {
|
|
504
|
+
expect(() => MatchersV3.uuid('not a uuid')).to.throw();
|
|
505
|
+
expect(() => MatchersV3.uuid('ba4bd1bc-5556-11eb-9286')).to.throw();
|
|
506
|
+
expect(() => MatchersV3.uuid('ba4bd1bc-5556-11eb-9286-d71bc5b507be-1234')).to.throw();
|
|
526
507
|
});
|
|
527
|
-
it('if no example is provided, it sets up a generator',
|
|
528
|
-
|
|
508
|
+
it('if no example is provided, it sets up a generator', () => {
|
|
509
|
+
const result = MatchersV3.uuid();
|
|
529
510
|
expect(result).to.deep.equal({
|
|
530
511
|
'pact:matcher:type': 'regex',
|
|
531
512
|
'pact:generator:type': 'Uuid',
|
|
@@ -534,9 +515,9 @@ describe('V3 Matchers', function () {
|
|
|
534
515
|
});
|
|
535
516
|
});
|
|
536
517
|
});
|
|
537
|
-
describe('#reify',
|
|
538
|
-
describe('when given an object with no matchers',
|
|
539
|
-
|
|
518
|
+
describe('#reify', () => {
|
|
519
|
+
describe('when given an object with no matchers', () => {
|
|
520
|
+
const object = {
|
|
540
521
|
value: 'data', // field name of value should not be only determination of isMatcher()
|
|
541
522
|
more: 'strings',
|
|
542
523
|
an: ['array'],
|
|
@@ -545,12 +526,12 @@ describe('V3 Matchers', function () {
|
|
|
545
526
|
withNumber: 1,
|
|
546
527
|
},
|
|
547
528
|
};
|
|
548
|
-
it('returns just that object',
|
|
529
|
+
it('returns just that object', () => {
|
|
549
530
|
expect(MatchersV3.reify(object)).to.deep.equal(object);
|
|
550
531
|
});
|
|
551
532
|
});
|
|
552
|
-
describe('when given an object with null values',
|
|
553
|
-
|
|
533
|
+
describe('when given an object with null values', () => {
|
|
534
|
+
const object = {
|
|
554
535
|
some: 'data',
|
|
555
536
|
more: null,
|
|
556
537
|
an: [null],
|
|
@@ -560,12 +541,12 @@ describe('V3 Matchers', function () {
|
|
|
560
541
|
andNull: null,
|
|
561
542
|
},
|
|
562
543
|
};
|
|
563
|
-
it('returns just that object',
|
|
544
|
+
it('returns just that object', () => {
|
|
564
545
|
expect(MatchersV3.reify(object)).to.deep.equal(object);
|
|
565
546
|
});
|
|
566
547
|
});
|
|
567
|
-
describe('when given an object with some matchers',
|
|
568
|
-
|
|
548
|
+
describe('when given an object with some matchers', () => {
|
|
549
|
+
const someMatchers = {
|
|
569
550
|
some: MatchersV3.like('data'),
|
|
570
551
|
more: 'strings',
|
|
571
552
|
an: ['array'],
|
|
@@ -578,7 +559,7 @@ describe('V3 Matchers', function () {
|
|
|
578
559
|
withAnotherNumber: MatchersV3.like(2),
|
|
579
560
|
},
|
|
580
561
|
};
|
|
581
|
-
|
|
562
|
+
const expected = {
|
|
582
563
|
some: 'data',
|
|
583
564
|
more: 'strings',
|
|
584
565
|
an: ['array'],
|
|
@@ -591,21 +572,21 @@ describe('V3 Matchers', function () {
|
|
|
591
572
|
withAnotherNumber: 2,
|
|
592
573
|
},
|
|
593
574
|
};
|
|
594
|
-
it('returns without matching guff',
|
|
575
|
+
it('returns without matching guff', () => {
|
|
595
576
|
expect(MatchersV3.reify(someMatchers)).to.deep.equal(expected);
|
|
596
577
|
});
|
|
597
578
|
});
|
|
598
|
-
describe('when given a simple matcher',
|
|
599
|
-
it('removes all matching guff',
|
|
600
|
-
|
|
601
|
-
|
|
579
|
+
describe('when given a simple matcher', () => {
|
|
580
|
+
it('removes all matching guff', () => {
|
|
581
|
+
const expected = 'myawesomeword';
|
|
582
|
+
const matcher = MatchersV3.regex('\\w+', 'myawesomeword');
|
|
602
583
|
expect(MatchersV3.isMatcher(matcher)).to.eq(true);
|
|
603
584
|
expect(MatchersV3.reify(matcher)).to.eql(expected);
|
|
604
585
|
});
|
|
605
586
|
});
|
|
606
|
-
describe('when given a complex nested object with matchers',
|
|
607
|
-
it('removes all matching guff',
|
|
608
|
-
|
|
587
|
+
describe('when given a complex nested object with matchers', () => {
|
|
588
|
+
it('removes all matching guff', () => {
|
|
589
|
+
const o = MatchersV3.like({
|
|
609
590
|
stringMatcher: {
|
|
610
591
|
awesomeSetting: MatchersV3.like('a string'),
|
|
611
592
|
},
|
|
@@ -625,7 +606,7 @@ describe('V3 Matchers', function () {
|
|
|
625
606
|
}, 3),
|
|
626
607
|
},
|
|
627
608
|
});
|
|
628
|
-
|
|
609
|
+
const expected = {
|
|
629
610
|
stringMatcher: {
|
|
630
611
|
awesomeSetting: 'a string',
|
|
631
612
|
},
|
|
@@ -658,13 +639,13 @@ describe('V3 Matchers', function () {
|
|
|
658
639
|
expect(MatchersV3.reify(o)).to.deep.equal(expected);
|
|
659
640
|
});
|
|
660
641
|
});
|
|
661
|
-
describe('when given a matcher and field named "value"',
|
|
662
|
-
it('should not be isMatcher"',
|
|
663
|
-
|
|
642
|
+
describe('when given a matcher and field named "value"', () => {
|
|
643
|
+
it('should not be isMatcher"', () => {
|
|
644
|
+
const resultMatcher = MatchersV3.like({
|
|
664
645
|
a: 'b',
|
|
665
646
|
c: MatchersV3.atLeastOneLike({ value: '1', a: 'b', aa: 'bb' }),
|
|
666
647
|
});
|
|
667
|
-
|
|
648
|
+
const result = MatchersV3.reify(resultMatcher);
|
|
668
649
|
expect(result).to.deep.equal({
|
|
669
650
|
a: 'b',
|
|
670
651
|
c: [{ value: '1', a: 'b', aa: 'bb' }],
|