@pact-foundation/pact 10.0.0-beta.54 → 10.0.0-beta.57
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 +578 -0
- package/CONTRIBUTING.md +1 -1
- package/MIGRATION.md +14 -0
- package/README.md +79 -29
- package/package.json +7 -10
- package/src/common/logger.js +2 -2
- package/src/common/logger.js.map +1 -1
- package/src/common/net.js +9 -7
- package/src/common/net.js.map +1 -1
- package/src/common/net.spec.js +5 -5
- package/src/common/net.spec.js.map +1 -1
- package/src/common/request.js +1 -1
- package/src/common/request.spec.js +7 -7
- package/src/common/request.spec.js.map +1 -1
- package/src/dsl/apolloGraphql.js +3 -1
- package/src/dsl/apolloGraphql.js.map +1 -1
- package/src/dsl/graphql.d.ts +16 -0
- package/src/dsl/graphql.js +39 -17
- package/src/dsl/graphql.js.map +1 -1
- package/src/dsl/graphql.spec.js +3 -3
- package/src/dsl/graphql.spec.js.map +1 -1
- package/src/dsl/interaction.d.ts +1 -1
- package/src/dsl/interaction.js +11 -11
- package/src/dsl/interaction.js.map +1 -1
- package/src/dsl/interaction.spec.js +2 -2
- package/src/dsl/interaction.spec.js.map +1 -1
- package/src/dsl/matchers.js +8 -8
- package/src/dsl/matchers.js.map +1 -1
- package/src/dsl/matchers.spec.js +146 -131
- package/src/dsl/matchers.spec.js.map +1 -1
- package/src/dsl/mockService.js +5 -5
- package/src/dsl/mockService.js.map +1 -1
- package/src/dsl/mockService.spec.js +9 -9
- package/src/dsl/mockService.spec.js.map +1 -1
- package/src/dsl/options.d.ts +1 -0
- package/src/dsl/publisher.spec.js +1 -1
- package/src/dsl/verifier/index.js +1 -1
- package/src/dsl/verifier/proxy/hooks.d.ts +0 -1
- package/src/dsl/verifier/proxy/hooks.js +10 -8
- package/src/dsl/verifier/proxy/hooks.js.map +1 -1
- package/src/dsl/verifier/proxy/index.js +1 -1
- package/src/dsl/verifier/proxy/proxy.js +13 -11
- package/src/dsl/verifier/proxy/proxy.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.spec.js +2 -2
- package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/index.js +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js +7 -6
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +5 -5
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +3 -2
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +3 -3
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/tracer.js +9 -7
- package/src/dsl/verifier/proxy/tracer.js.map +1 -1
- package/src/dsl/verifier/verifier.js +12 -12
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/dsl/verifier/verifier.spec.js +1 -1
- package/src/errors/configurationError.js +3 -1
- package/src/errors/configurationError.js.map +1 -1
- package/src/errors/graphQLQueryError.js +3 -1
- package/src/errors/graphQLQueryError.js.map +1 -1
- package/src/errors/matcherError.js +3 -1
- package/src/errors/matcherError.js.map +1 -1
- package/src/errors/verificationError.js +3 -1
- package/src/errors/verificationError.js.map +1 -1
- package/src/httpPact/index.js +35 -21
- package/src/httpPact/index.js.map +1 -1
- package/src/httpPact/tracing.js +5 -4
- package/src/httpPact/tracing.js.map +1 -1
- package/src/index.js +3 -3
- package/src/messageConsumerPact.js +8 -8
- package/src/messageConsumerPact.js.map +1 -1
- package/src/messageConsumerPact.spec.js +4 -4
- package/src/messageConsumerPact.spec.js.map +1 -1
- package/src/messageProviderPact.js +18 -15
- package/src/messageProviderPact.js.map +1 -1
- package/src/messageProviderPact.spec.js +6 -6
- package/src/messageProviderPact.spec.js.map +1 -1
- package/src/v3/index.js +3 -9
- package/src/v3/index.js.map +1 -1
- package/src/v3/matchers.d.ts +4 -4
- package/src/v3/matchers.js +74 -46
- package/src/v3/matchers.js.map +1 -1
- package/src/v3/matchers.spec.js +3 -47
- package/src/v3/matchers.spec.js.map +1 -1
- package/src/v3/pact.d.ts +22 -4
- package/src/v3/pact.js +197 -75
- package/src/v3/pact.js.map +1 -1
- package/src/v3/verifier.d.ts +3 -27
- package/src/v3/verifier.js +2 -19
- package/src/v3/verifier.js.map +1 -1
- package/src/v3/xml/xmlElement.js +3 -1
- package/src/v3/xml/xmlElement.js.map +1 -1
- package/src/v3/xml/xmlElement.spec.js +7 -7
- package/src/v3/xml/xmlElement.spec.js.map +1 -1
- package/src/v3/xml/xmlText.js +3 -1
- package/src/v3/xml/xmlText.js.map +1 -1
- package/test/helper.js +1 -1
- package/v3/index.js +1 -1
- package/ROADMAP.md +0 -20
package/src/dsl/matchers.spec.js
CHANGED
|
@@ -17,7 +17,7 @@ describe('Matcher', function () {
|
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
-
var a = matchers_1.like(template);
|
|
20
|
+
var a = (0, matchers_1.like)(template);
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
describe('with types', function () {
|
|
@@ -32,17 +32,17 @@ describe('Matcher', function () {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
-
var a = matchers_1.like(template);
|
|
35
|
+
var a = (0, matchers_1.like)(template);
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
38
|
it('compiles nested likes', function () {
|
|
39
39
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
-
var a = matchers_1.like({
|
|
40
|
+
var a = (0, matchers_1.like)({
|
|
41
41
|
someArray: ['one', 'two'],
|
|
42
|
-
someNumber: matchers_1.like(1),
|
|
42
|
+
someNumber: (0, matchers_1.like)(1),
|
|
43
43
|
someString: "it's a string",
|
|
44
|
-
someObject: matchers_1.like({
|
|
45
|
-
foo: matchers_1.like('some string'),
|
|
44
|
+
someObject: (0, matchers_1.like)({
|
|
45
|
+
foo: (0, matchers_1.like)('some string'),
|
|
46
46
|
bar: 'some other string',
|
|
47
47
|
}),
|
|
48
48
|
});
|
|
@@ -52,19 +52,19 @@ describe('Matcher', function () {
|
|
|
52
52
|
describe('when given a valid regex', function () {
|
|
53
53
|
describe('and a matching example', function () {
|
|
54
54
|
it('returns true', function () {
|
|
55
|
-
chai_1.expect(matchers_1.validateExample('2010-01-01', matchers_1.ISO8601_DATE_FORMAT)).to.eql(true);
|
|
55
|
+
(0, chai_1.expect)((0, matchers_1.validateExample)('2010-01-01', matchers_1.ISO8601_DATE_FORMAT)).to.eql(true);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
describe('and a failing example', function () {
|
|
59
59
|
it('returns false', function () {
|
|
60
|
-
chai_1.expect(matchers_1.validateExample('not a date', matchers_1.ISO8601_DATE_FORMAT)).to.eql(false);
|
|
60
|
+
(0, chai_1.expect)((0, matchers_1.validateExample)('not a date', matchers_1.ISO8601_DATE_FORMAT)).to.eql(false);
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
describe('when given an invalid regex', function () {
|
|
65
65
|
it('returns an error', function () {
|
|
66
|
-
chai_1.expect(function () {
|
|
67
|
-
matchers_1.validateExample('', 'abc(');
|
|
66
|
+
(0, chai_1.expect)(function () {
|
|
67
|
+
(0, matchers_1.validateExample)('', 'abc(');
|
|
68
68
|
}).to.throw(Error);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -83,35 +83,35 @@ describe('Matcher', function () {
|
|
|
83
83
|
},
|
|
84
84
|
json_class: 'Pact::Term',
|
|
85
85
|
};
|
|
86
|
-
var match = matchers_1.term({
|
|
86
|
+
var match = (0, matchers_1.term)({
|
|
87
87
|
generate: 'myawesomeword',
|
|
88
88
|
matcher: '\\w+',
|
|
89
89
|
});
|
|
90
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
90
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
describe('when not provided with a valid expression', function () {
|
|
94
94
|
var createTheTerm = function (badArg) { return function () {
|
|
95
|
-
matchers_1.term(badArg);
|
|
95
|
+
(0, matchers_1.term)(badArg);
|
|
96
96
|
}; };
|
|
97
97
|
describe('when no term is provided', function () {
|
|
98
98
|
it('throws an Error', function () {
|
|
99
|
-
chai_1.expect(createTheTerm.call({})).to.throw(Error);
|
|
99
|
+
(0, chai_1.expect)(createTheTerm.call({})).to.throw(Error);
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
describe('when an invalid term is provided', function () {
|
|
103
103
|
it('throws an Error', function () {
|
|
104
|
-
chai_1.expect(createTheTerm({})).to.throw(Error);
|
|
105
|
-
chai_1.expect(createTheTerm('')).to.throw(Error);
|
|
106
|
-
chai_1.expect(createTheTerm({ generate: 'foo' })).to.throw(Error);
|
|
107
|
-
chai_1.expect(createTheTerm({ matcher: '\\w+' })).to.throw(Error);
|
|
104
|
+
(0, chai_1.expect)(createTheTerm({})).to.throw(Error);
|
|
105
|
+
(0, chai_1.expect)(createTheTerm('')).to.throw(Error);
|
|
106
|
+
(0, chai_1.expect)(createTheTerm({ generate: 'foo' })).to.throw(Error);
|
|
107
|
+
(0, chai_1.expect)(createTheTerm({ matcher: '\\w+' })).to.throw(Error);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
describe("when given an example that doesn't match the regular expression", function () {
|
|
112
112
|
it('fails with an error', function () {
|
|
113
|
-
chai_1.expect(function () {
|
|
114
|
-
matchers_1.term({
|
|
113
|
+
(0, chai_1.expect)(function () {
|
|
114
|
+
(0, matchers_1.term)({
|
|
115
115
|
generate: 'abc',
|
|
116
116
|
matcher: matchers_1.ISO8601_DATE_FORMAT,
|
|
117
117
|
});
|
|
@@ -126,23 +126,23 @@ describe('Matcher', function () {
|
|
|
126
126
|
contents: 'myspecialvalue',
|
|
127
127
|
json_class: 'Pact::SomethingLike',
|
|
128
128
|
};
|
|
129
|
-
var match = matchers_1.somethingLike('myspecialvalue');
|
|
130
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
129
|
+
var match = (0, matchers_1.somethingLike)('myspecialvalue');
|
|
130
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
describe('when not provided with a valid value', function () {
|
|
134
134
|
var createTheValue = function (badArg) { return function () {
|
|
135
|
-
matchers_1.somethingLike(badArg);
|
|
135
|
+
(0, matchers_1.somethingLike)(badArg);
|
|
136
136
|
}; };
|
|
137
137
|
describe('when no value is provided', function () {
|
|
138
138
|
it('`throws an Error', function () {
|
|
139
|
-
chai_1.expect(createTheValue.call({})).to.throw(Error);
|
|
139
|
+
(0, chai_1.expect)(createTheValue.call({})).to.throw(Error);
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
describe('when an invalid value is provided', function () {
|
|
143
143
|
it('throws an Error', function () {
|
|
144
|
-
chai_1.expect(createTheValue(undefined)).to.throw(Error);
|
|
145
|
-
chai_1.expect(createTheValue(function () { })).to.throw(Error);
|
|
144
|
+
(0, chai_1.expect)(createTheValue(undefined)).to.throw(Error);
|
|
145
|
+
(0, chai_1.expect)(createTheValue(function () { })).to.throw(Error);
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
148
|
});
|
|
@@ -155,8 +155,8 @@ describe('Matcher', function () {
|
|
|
155
155
|
json_class: 'Pact::ArrayLike',
|
|
156
156
|
min: 1,
|
|
157
157
|
};
|
|
158
|
-
var match = matchers_1.eachLike(null, { min: 1 });
|
|
159
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
158
|
+
var match = (0, matchers_1.eachLike)(null, { min: 1 });
|
|
159
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
describe('when an object is provided', function () {
|
|
@@ -166,14 +166,14 @@ describe('Matcher', function () {
|
|
|
166
166
|
json_class: 'Pact::ArrayLike',
|
|
167
167
|
min: 1,
|
|
168
168
|
};
|
|
169
|
-
var match = matchers_1.eachLike({ a: 1 }, { min: 1 });
|
|
170
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
169
|
+
var match = (0, matchers_1.eachLike)({ a: 1 }, { min: 1 });
|
|
170
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
171
171
|
});
|
|
172
172
|
});
|
|
173
173
|
describe('when object.min is invalid', function () {
|
|
174
174
|
it('throws an Error message', function () {
|
|
175
|
-
chai_1.expect(function () {
|
|
176
|
-
matchers_1.eachLike({ a: 1 }, { min: 0 });
|
|
175
|
+
(0, chai_1.expect)(function () {
|
|
176
|
+
(0, matchers_1.eachLike)({ a: 1 }, { min: 0 });
|
|
177
177
|
}).to.throw(Error);
|
|
178
178
|
});
|
|
179
179
|
});
|
|
@@ -184,8 +184,8 @@ describe('Matcher', function () {
|
|
|
184
184
|
json_class: 'Pact::ArrayLike',
|
|
185
185
|
min: 1,
|
|
186
186
|
};
|
|
187
|
-
var match = matchers_1.eachLike([1, 2, 3], { min: 1 });
|
|
188
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
187
|
+
var match = (0, matchers_1.eachLike)([1, 2, 3], { min: 1 });
|
|
188
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
191
|
describe('when a value is provided', function () {
|
|
@@ -195,8 +195,8 @@ describe('Matcher', function () {
|
|
|
195
195
|
json_class: 'Pact::ArrayLike',
|
|
196
196
|
min: 1,
|
|
197
197
|
};
|
|
198
|
-
var match = matchers_1.eachLike('test', { min: 1 });
|
|
199
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
198
|
+
var match = (0, matchers_1.eachLike)('test', { min: 1 });
|
|
199
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
202
|
describe('when the content has Pact.Macters', function () {
|
|
@@ -212,8 +212,8 @@ describe('Matcher', function () {
|
|
|
212
212
|
json_class: 'Pact::ArrayLike',
|
|
213
213
|
min: 1,
|
|
214
214
|
};
|
|
215
|
-
var match = matchers_1.eachLike({ id: matchers_1.somethingLike(10) }, { min: 1 });
|
|
216
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
215
|
+
var match = (0, matchers_1.eachLike)({ id: (0, matchers_1.somethingLike)(10) }, { min: 1 });
|
|
216
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
217
217
|
});
|
|
218
218
|
});
|
|
219
219
|
describe('of type term', function () {
|
|
@@ -235,13 +235,13 @@ describe('Matcher', function () {
|
|
|
235
235
|
json_class: 'Pact::ArrayLike',
|
|
236
236
|
min: 1,
|
|
237
237
|
};
|
|
238
|
-
var match = matchers_1.eachLike({
|
|
239
|
-
colour: matchers_1.term({
|
|
238
|
+
var match = (0, matchers_1.eachLike)({
|
|
239
|
+
colour: (0, matchers_1.term)({
|
|
240
240
|
generate: 'red',
|
|
241
241
|
matcher: 'red|green',
|
|
242
242
|
}),
|
|
243
243
|
}, { min: 1 });
|
|
244
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
244
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
describe('of type eachLike', function () {
|
|
@@ -255,8 +255,8 @@ describe('Matcher', function () {
|
|
|
255
255
|
json_class: 'Pact::ArrayLike',
|
|
256
256
|
min: 1,
|
|
257
257
|
};
|
|
258
|
-
var match = matchers_1.eachLike(matchers_1.eachLike('blue', { min: 1 }), { min: 1 });
|
|
259
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
258
|
+
var match = (0, matchers_1.eachLike)((0, matchers_1.eachLike)('blue', { min: 1 }), { min: 1 });
|
|
259
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
260
260
|
});
|
|
261
261
|
});
|
|
262
262
|
describe('complex object with multiple Pact.Matchers', function () {
|
|
@@ -300,12 +300,12 @@ describe('Matcher', function () {
|
|
|
300
300
|
json_class: 'Pact::ArrayLike',
|
|
301
301
|
min: 1,
|
|
302
302
|
};
|
|
303
|
-
var match = matchers_1.eachLike(matchers_1.eachLike({
|
|
304
|
-
colour: matchers_1.term({ generate: 'red', matcher: 'red|green|blue' }),
|
|
305
|
-
size: matchers_1.somethingLike(10),
|
|
306
|
-
tag: matchers_1.eachLike([matchers_1.somethingLike('jumper'), matchers_1.somethingLike('shirt')], { min: 2 }),
|
|
303
|
+
var match = (0, matchers_1.eachLike)((0, matchers_1.eachLike)({
|
|
304
|
+
colour: (0, matchers_1.term)({ generate: 'red', matcher: 'red|green|blue' }),
|
|
305
|
+
size: (0, matchers_1.somethingLike)(10),
|
|
306
|
+
tag: (0, matchers_1.eachLike)([(0, matchers_1.somethingLike)('jumper'), (0, matchers_1.somethingLike)('shirt')], { min: 2 }),
|
|
307
307
|
}, { min: 1 }), { min: 1 });
|
|
308
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
308
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
309
309
|
});
|
|
310
310
|
});
|
|
311
311
|
});
|
|
@@ -316,8 +316,8 @@ describe('Matcher', function () {
|
|
|
316
316
|
json_class: 'Pact::ArrayLike',
|
|
317
317
|
min: 1,
|
|
318
318
|
};
|
|
319
|
-
var match = matchers_1.eachLike({ a: 1 });
|
|
320
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
319
|
+
var match = (0, matchers_1.eachLike)({ a: 1 });
|
|
320
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
323
|
describe('When a options.min is provided', function () {
|
|
@@ -327,24 +327,24 @@ describe('Matcher', function () {
|
|
|
327
327
|
json_class: 'Pact::ArrayLike',
|
|
328
328
|
min: 3,
|
|
329
329
|
};
|
|
330
|
-
var match = matchers_1.eachLike({ a: 1 }, { min: 3 });
|
|
331
|
-
chai_1.expect(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
330
|
+
var match = (0, matchers_1.eachLike)({ a: 1 }, { min: 3 });
|
|
331
|
+
(0, chai_1.expect)(JSON.stringify(match)).to.deep.include(JSON.stringify(expected));
|
|
332
332
|
});
|
|
333
333
|
});
|
|
334
334
|
});
|
|
335
335
|
describe('#email', function () {
|
|
336
336
|
describe('when given a valid Email address', function () {
|
|
337
337
|
it('creates a valid matcher', function () {
|
|
338
|
-
chai_1.expect(matchers_1.email('hello@world.com')).to.be.an('object');
|
|
339
|
-
chai_1.expect(matchers_1.email('hello@world.com.au')).to.be.an('object');
|
|
340
|
-
chai_1.expect(matchers_1.email('hello@a.co')).to.be.an('object');
|
|
341
|
-
chai_1.expect(matchers_1.email()).to.be.an('object');
|
|
338
|
+
(0, chai_1.expect)((0, matchers_1.email)('hello@world.com')).to.be.an('object');
|
|
339
|
+
(0, chai_1.expect)((0, matchers_1.email)('hello@world.com.au')).to.be.an('object');
|
|
340
|
+
(0, chai_1.expect)((0, matchers_1.email)('hello@a.co')).to.be.an('object');
|
|
341
|
+
(0, chai_1.expect)((0, matchers_1.email)()).to.be.an('object');
|
|
342
342
|
});
|
|
343
343
|
});
|
|
344
344
|
describe('when given an invalid Email address', function () {
|
|
345
345
|
it('returns an error', function () {
|
|
346
|
-
chai_1.expect(function () {
|
|
347
|
-
matchers_1.email('hello.world.c');
|
|
346
|
+
(0, chai_1.expect)(function () {
|
|
347
|
+
(0, matchers_1.email)('hello.world.c');
|
|
348
348
|
}).to.throw(Error);
|
|
349
349
|
});
|
|
350
350
|
});
|
|
@@ -352,14 +352,14 @@ describe('Matcher', function () {
|
|
|
352
352
|
describe('#uuid', function () {
|
|
353
353
|
describe('when given a valid UUID', function () {
|
|
354
354
|
it('creates a valid matcher', function () {
|
|
355
|
-
chai_1.expect(matchers_1.uuid('ce118b6e-d8e1-11e7-9296-cec278b6b50a')).to.be.an('object');
|
|
356
|
-
chai_1.expect(matchers_1.uuid()).to.be.an('object');
|
|
355
|
+
(0, chai_1.expect)((0, matchers_1.uuid)('ce118b6e-d8e1-11e7-9296-cec278b6b50a')).to.be.an('object');
|
|
356
|
+
(0, chai_1.expect)((0, matchers_1.uuid)()).to.be.an('object');
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
359
|
describe('when given an invalid UUID', function () {
|
|
360
360
|
it('returns an error', function () {
|
|
361
|
-
chai_1.expect(function () {
|
|
362
|
-
matchers_1.uuid('abc');
|
|
361
|
+
(0, chai_1.expect)(function () {
|
|
362
|
+
(0, matchers_1.uuid)('abc');
|
|
363
363
|
}).to.throw(Error);
|
|
364
364
|
});
|
|
365
365
|
});
|
|
@@ -367,14 +367,14 @@ describe('Matcher', function () {
|
|
|
367
367
|
describe('#ipv4Address', function () {
|
|
368
368
|
describe('when given a valid ipv4Address', function () {
|
|
369
369
|
it('creates a valid matcher', function () {
|
|
370
|
-
chai_1.expect(matchers_1.ipv4Address('127.0.0.1')).to.be.an('object');
|
|
371
|
-
chai_1.expect(matchers_1.ipv4Address()).to.be.an('object');
|
|
370
|
+
(0, chai_1.expect)((0, matchers_1.ipv4Address)('127.0.0.1')).to.be.an('object');
|
|
371
|
+
(0, chai_1.expect)((0, matchers_1.ipv4Address)()).to.be.an('object');
|
|
372
372
|
});
|
|
373
373
|
});
|
|
374
374
|
describe('when given an invalid ipv4Address', function () {
|
|
375
375
|
it('returns an error', function () {
|
|
376
|
-
chai_1.expect(function () {
|
|
377
|
-
matchers_1.ipv4Address('abc');
|
|
376
|
+
(0, chai_1.expect)(function () {
|
|
377
|
+
(0, matchers_1.ipv4Address)('abc');
|
|
378
378
|
}).to.throw(Error);
|
|
379
379
|
});
|
|
380
380
|
});
|
|
@@ -382,15 +382,15 @@ describe('Matcher', function () {
|
|
|
382
382
|
describe('#ipv6Address', function () {
|
|
383
383
|
describe('when given a valid ipv6Address', function () {
|
|
384
384
|
it('creates a valid matcher', function () {
|
|
385
|
-
chai_1.expect(matchers_1.ipv6Address('::1')).to.be.an('object');
|
|
386
|
-
chai_1.expect(matchers_1.ipv6Address('2001:0db8:85a3:0000:0000:8a2e:0370:7334')).to.be.an('object');
|
|
387
|
-
chai_1.expect(matchers_1.ipv6Address()).to.be.an('object');
|
|
385
|
+
(0, chai_1.expect)((0, matchers_1.ipv6Address)('::1')).to.be.an('object');
|
|
386
|
+
(0, chai_1.expect)((0, matchers_1.ipv6Address)('2001:0db8:85a3:0000:0000:8a2e:0370:7334')).to.be.an('object');
|
|
387
|
+
(0, chai_1.expect)((0, matchers_1.ipv6Address)()).to.be.an('object');
|
|
388
388
|
});
|
|
389
389
|
});
|
|
390
390
|
describe('when given an invalid ipv6Address', function () {
|
|
391
391
|
it('returns an error', function () {
|
|
392
|
-
chai_1.expect(function () {
|
|
393
|
-
matchers_1.ipv6Address('abc');
|
|
392
|
+
(0, chai_1.expect)(function () {
|
|
393
|
+
(0, matchers_1.ipv6Address)('abc');
|
|
394
394
|
}).to.throw(Error);
|
|
395
395
|
});
|
|
396
396
|
});
|
|
@@ -398,14 +398,14 @@ describe('Matcher', function () {
|
|
|
398
398
|
describe('#hexadecimal', function () {
|
|
399
399
|
describe('when given a valid hexadecimal', function () {
|
|
400
400
|
it('creates a valid matcher', function () {
|
|
401
|
-
chai_1.expect(matchers_1.hexadecimal('6F')).to.be.an('object');
|
|
402
|
-
chai_1.expect(matchers_1.hexadecimal()).to.be.an('object');
|
|
401
|
+
(0, chai_1.expect)((0, matchers_1.hexadecimal)('6F')).to.be.an('object');
|
|
402
|
+
(0, chai_1.expect)((0, matchers_1.hexadecimal)()).to.be.an('object');
|
|
403
403
|
});
|
|
404
404
|
});
|
|
405
405
|
describe('when given an invalid hexadecimal', function () {
|
|
406
406
|
it('returns an error', function () {
|
|
407
|
-
chai_1.expect(function () {
|
|
408
|
-
matchers_1.hexadecimal('x1');
|
|
407
|
+
(0, chai_1.expect)(function () {
|
|
408
|
+
(0, matchers_1.hexadecimal)('x1');
|
|
409
409
|
}).to.throw(Error);
|
|
410
410
|
});
|
|
411
411
|
});
|
|
@@ -413,43 +413,43 @@ describe('Matcher', function () {
|
|
|
413
413
|
describe('#boolean', function () {
|
|
414
414
|
describe('when used it should create a JSON object', function () {
|
|
415
415
|
it('creates a valid matcher', function () {
|
|
416
|
-
chai_1.expect(matchers_1.boolean()).to.be.an('object');
|
|
417
|
-
chai_1.expect(matchers_1.boolean().contents).to.equal(true);
|
|
416
|
+
(0, chai_1.expect)((0, matchers_1.boolean)()).to.be.an('object');
|
|
417
|
+
(0, chai_1.expect)((0, matchers_1.boolean)().contents).to.equal(true);
|
|
418
418
|
});
|
|
419
419
|
it('sets value=false', function () {
|
|
420
|
-
chai_1.expect(matchers_1.boolean(false)).to.be.an('object');
|
|
421
|
-
chai_1.expect(matchers_1.boolean(false).contents).to.equal(false);
|
|
420
|
+
(0, chai_1.expect)((0, matchers_1.boolean)(false)).to.be.an('object');
|
|
421
|
+
(0, chai_1.expect)((0, matchers_1.boolean)(false).contents).to.equal(false);
|
|
422
422
|
});
|
|
423
423
|
it('sets value=true', function () {
|
|
424
|
-
chai_1.expect(matchers_1.boolean(true)).to.be.an('object');
|
|
425
|
-
chai_1.expect(matchers_1.boolean(true).contents).to.equal(true);
|
|
424
|
+
(0, chai_1.expect)((0, matchers_1.boolean)(true)).to.be.an('object');
|
|
425
|
+
(0, chai_1.expect)((0, matchers_1.boolean)(true).contents).to.equal(true);
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
429
|
describe('#string', function () {
|
|
430
430
|
describe('when given a valid string', function () {
|
|
431
431
|
it('creates a valid matcher', function () {
|
|
432
|
-
chai_1.expect(matchers_1.string('test')).to.be.an('object');
|
|
433
|
-
chai_1.expect(matchers_1.string()).to.be.an('object');
|
|
434
|
-
chai_1.expect(matchers_1.string('test').contents).to.equal('test');
|
|
432
|
+
(0, chai_1.expect)((0, matchers_1.string)('test')).to.be.an('object');
|
|
433
|
+
(0, chai_1.expect)((0, matchers_1.string)()).to.be.an('object');
|
|
434
|
+
(0, chai_1.expect)((0, matchers_1.string)('test').contents).to.equal('test');
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
437
|
});
|
|
438
438
|
describe('#decimal', function () {
|
|
439
439
|
describe('when given a valid decimal', function () {
|
|
440
440
|
it('creates a valid matcher', function () {
|
|
441
|
-
chai_1.expect(matchers_1.decimal(10.1)).to.be.an('object');
|
|
442
|
-
chai_1.expect(matchers_1.decimal()).to.be.an('object');
|
|
443
|
-
chai_1.expect(matchers_1.decimal(0.0).contents).to.equal(0.0);
|
|
441
|
+
(0, chai_1.expect)((0, matchers_1.decimal)(10.1)).to.be.an('object');
|
|
442
|
+
(0, chai_1.expect)((0, matchers_1.decimal)()).to.be.an('object');
|
|
443
|
+
(0, chai_1.expect)((0, matchers_1.decimal)(0.0).contents).to.equal(0.0);
|
|
444
444
|
});
|
|
445
445
|
});
|
|
446
446
|
});
|
|
447
447
|
describe('#integer', function () {
|
|
448
448
|
describe('when given a valid integer', function () {
|
|
449
449
|
it('creates a valid matcher', function () {
|
|
450
|
-
chai_1.expect(matchers_1.integer(10)).to.be.an('object');
|
|
451
|
-
chai_1.expect(matchers_1.integer()).to.be.an('object');
|
|
452
|
-
chai_1.expect(matchers_1.integer(0).contents).to.equal(0);
|
|
450
|
+
(0, chai_1.expect)((0, matchers_1.integer)(10)).to.be.an('object');
|
|
451
|
+
(0, chai_1.expect)((0, matchers_1.integer)()).to.be.an('object');
|
|
452
|
+
(0, chai_1.expect)((0, matchers_1.integer)(0).contents).to.equal(0);
|
|
453
453
|
});
|
|
454
454
|
});
|
|
455
455
|
});
|
|
@@ -457,14 +457,14 @@ describe('Matcher', function () {
|
|
|
457
457
|
describe('#rfc1123Timestamp', function () {
|
|
458
458
|
describe('when given a valid rfc1123Timestamp', function () {
|
|
459
459
|
it('creates a valid matcher', function () {
|
|
460
|
-
chai_1.expect(matchers_1.rfc1123Timestamp('Mon, 31 Oct 2016 15:21:41 -0400')).to.be.an('object');
|
|
461
|
-
chai_1.expect(matchers_1.rfc1123Timestamp()).to.be.an('object');
|
|
460
|
+
(0, chai_1.expect)((0, matchers_1.rfc1123Timestamp)('Mon, 31 Oct 2016 15:21:41 -0400')).to.be.an('object');
|
|
461
|
+
(0, chai_1.expect)((0, matchers_1.rfc1123Timestamp)()).to.be.an('object');
|
|
462
462
|
});
|
|
463
463
|
});
|
|
464
464
|
describe('when given an invalid rfc1123Timestamp', function () {
|
|
465
465
|
it('returns an error', function () {
|
|
466
|
-
chai_1.expect(function () {
|
|
467
|
-
matchers_1.rfc1123Timestamp('abc');
|
|
466
|
+
(0, chai_1.expect)(function () {
|
|
467
|
+
(0, matchers_1.rfc1123Timestamp)('abc');
|
|
468
468
|
}).to.throw(Error);
|
|
469
469
|
});
|
|
470
470
|
});
|
|
@@ -472,14 +472,14 @@ describe('Matcher', function () {
|
|
|
472
472
|
describe('#iso8601Time', function () {
|
|
473
473
|
describe('when given a valid iso8601Time', function () {
|
|
474
474
|
it('creates a valid matcher', function () {
|
|
475
|
-
chai_1.expect(matchers_1.iso8601Time('T22:44:30.652Z')).to.be.an('object');
|
|
476
|
-
chai_1.expect(matchers_1.iso8601Time()).to.be.an('object');
|
|
475
|
+
(0, chai_1.expect)((0, matchers_1.iso8601Time)('T22:44:30.652Z')).to.be.an('object');
|
|
476
|
+
(0, chai_1.expect)((0, matchers_1.iso8601Time)()).to.be.an('object');
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
479
|
describe('when given an invalid iso8601Time', function () {
|
|
480
480
|
it('returns an error', function () {
|
|
481
|
-
chai_1.expect(function () {
|
|
482
|
-
matchers_1.iso8601Time('abc');
|
|
481
|
+
(0, chai_1.expect)(function () {
|
|
482
|
+
(0, matchers_1.iso8601Time)('abc');
|
|
483
483
|
}).to.throw(Error);
|
|
484
484
|
});
|
|
485
485
|
});
|
|
@@ -487,14 +487,14 @@ describe('Matcher', function () {
|
|
|
487
487
|
describe('#iso8601Date', function () {
|
|
488
488
|
describe('when given a valid iso8601Date', function () {
|
|
489
489
|
it('creates a valid matcher', function () {
|
|
490
|
-
chai_1.expect(matchers_1.iso8601Date('2017-12-05')).to.be.an('object');
|
|
491
|
-
chai_1.expect(matchers_1.iso8601Date()).to.be.an('object');
|
|
490
|
+
(0, chai_1.expect)((0, matchers_1.iso8601Date)('2017-12-05')).to.be.an('object');
|
|
491
|
+
(0, chai_1.expect)((0, matchers_1.iso8601Date)()).to.be.an('object');
|
|
492
492
|
});
|
|
493
493
|
});
|
|
494
494
|
describe('when given an invalid iso8601Date', function () {
|
|
495
495
|
it('returns an error', function () {
|
|
496
|
-
chai_1.expect(function () {
|
|
497
|
-
matchers_1.iso8601Date('abc');
|
|
496
|
+
(0, chai_1.expect)(function () {
|
|
497
|
+
(0, matchers_1.iso8601Date)('abc');
|
|
498
498
|
}).to.throw(Error);
|
|
499
499
|
});
|
|
500
500
|
});
|
|
@@ -502,14 +502,14 @@ describe('Matcher', function () {
|
|
|
502
502
|
describe('#iso8601DateTime', function () {
|
|
503
503
|
describe('when given a valid iso8601DateTime', function () {
|
|
504
504
|
it('creates a valid matcher', function () {
|
|
505
|
-
chai_1.expect(matchers_1.iso8601DateTime('2015-08-06T16:53:10+01:00')).to.be.an('object');
|
|
506
|
-
chai_1.expect(matchers_1.iso8601DateTime()).to.be.an('object');
|
|
505
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTime)('2015-08-06T16:53:10+01:00')).to.be.an('object');
|
|
506
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTime)()).to.be.an('object');
|
|
507
507
|
});
|
|
508
508
|
});
|
|
509
509
|
describe('when given an invalid iso8601DateTime', function () {
|
|
510
510
|
it('returns an error', function () {
|
|
511
|
-
chai_1.expect(function () {
|
|
512
|
-
matchers_1.iso8601DateTime('abc');
|
|
511
|
+
(0, chai_1.expect)(function () {
|
|
512
|
+
(0, matchers_1.iso8601DateTime)('abc');
|
|
513
513
|
}).to.throw(Error);
|
|
514
514
|
});
|
|
515
515
|
});
|
|
@@ -517,17 +517,17 @@ describe('Matcher', function () {
|
|
|
517
517
|
describe('#iso8601DateTimeWithMillis', function () {
|
|
518
518
|
describe('when given a valid iso8601DateTimeWithMillis', function () {
|
|
519
519
|
it('creates a valid matcher', function () {
|
|
520
|
-
chai_1.expect(matchers_1.iso8601DateTimeWithMillis('2015-08-06T16:53:10.123+01:00')).to.be.an('object');
|
|
521
|
-
chai_1.expect(matchers_1.iso8601DateTimeWithMillis('2015-08-06T16:53:10.537357Z')).to.be.an('object');
|
|
522
|
-
chai_1.expect(matchers_1.iso8601DateTimeWithMillis('2020-12-10T09:01:29.06Z')).to.be.an('object');
|
|
523
|
-
chai_1.expect(matchers_1.iso8601DateTimeWithMillis('2020-12-10T09:01:29.1Z')).to.be.an('object');
|
|
524
|
-
chai_1.expect(matchers_1.iso8601DateTimeWithMillis()).to.be.an('object');
|
|
520
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTimeWithMillis)('2015-08-06T16:53:10.123+01:00')).to.be.an('object');
|
|
521
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTimeWithMillis)('2015-08-06T16:53:10.537357Z')).to.be.an('object');
|
|
522
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTimeWithMillis)('2020-12-10T09:01:29.06Z')).to.be.an('object');
|
|
523
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTimeWithMillis)('2020-12-10T09:01:29.1Z')).to.be.an('object');
|
|
524
|
+
(0, chai_1.expect)((0, matchers_1.iso8601DateTimeWithMillis)()).to.be.an('object');
|
|
525
525
|
});
|
|
526
526
|
});
|
|
527
527
|
describe('when given an invalid iso8601DateTimeWithMillis', function () {
|
|
528
528
|
it('returns an error', function () {
|
|
529
|
-
chai_1.expect(function () {
|
|
530
|
-
matchers_1.iso8601DateTimeWithMillis('abc');
|
|
529
|
+
(0, chai_1.expect)(function () {
|
|
530
|
+
(0, matchers_1.iso8601DateTimeWithMillis)('abc');
|
|
531
531
|
}).to.throw(Error);
|
|
532
532
|
});
|
|
533
533
|
});
|
|
@@ -544,20 +544,35 @@ describe('Matcher', function () {
|
|
|
544
544
|
},
|
|
545
545
|
};
|
|
546
546
|
it('returns just that object', function () {
|
|
547
|
-
chai_1.expect(matchers_1.extractPayload(object)).to.deep.equal(object);
|
|
547
|
+
(0, chai_1.expect)((0, matchers_1.extractPayload)(object)).to.deep.equal(object);
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
describe('when given an object with null values', function () {
|
|
551
|
+
var object = {
|
|
552
|
+
some: 'data',
|
|
553
|
+
more: null,
|
|
554
|
+
an: [null],
|
|
555
|
+
someObject: {
|
|
556
|
+
withData: true,
|
|
557
|
+
withNumber: 1,
|
|
558
|
+
andNull: null,
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
it('returns just that object', function () {
|
|
562
|
+
(0, chai_1.expect)((0, matchers_1.extractPayload)(object)).to.deep.equal(object);
|
|
548
563
|
});
|
|
549
564
|
});
|
|
550
565
|
describe('when given an object with some matchers', function () {
|
|
551
566
|
var someMatchers = {
|
|
552
|
-
some: matchers_1.somethingLike('data'),
|
|
567
|
+
some: (0, matchers_1.somethingLike)('data'),
|
|
553
568
|
more: 'strings',
|
|
554
569
|
an: ['array'],
|
|
555
|
-
another: matchers_1.eachLike('this'),
|
|
570
|
+
another: (0, matchers_1.eachLike)('this'),
|
|
556
571
|
someObject: {
|
|
557
|
-
withData: matchers_1.somethingLike(true),
|
|
558
|
-
withTerm: matchers_1.term({ generate: 'this', matcher: 'this|that' }),
|
|
572
|
+
withData: (0, matchers_1.somethingLike)(true),
|
|
573
|
+
withTerm: (0, matchers_1.term)({ generate: 'this', matcher: 'this|that' }),
|
|
559
574
|
withNumber: 1,
|
|
560
|
-
withAnotherNumber: matchers_1.somethingLike(2),
|
|
575
|
+
withAnotherNumber: (0, matchers_1.somethingLike)(2),
|
|
561
576
|
},
|
|
562
577
|
};
|
|
563
578
|
var expected = {
|
|
@@ -573,39 +588,39 @@ describe('Matcher', function () {
|
|
|
573
588
|
},
|
|
574
589
|
};
|
|
575
590
|
it('returns without matching guff', function () {
|
|
576
|
-
chai_1.expect(matchers_1.extractPayload(someMatchers)).to.deep.equal(expected);
|
|
591
|
+
(0, chai_1.expect)((0, matchers_1.extractPayload)(someMatchers)).to.deep.equal(expected);
|
|
577
592
|
});
|
|
578
593
|
});
|
|
579
594
|
describe('when given a simple matcher', function () {
|
|
580
595
|
it('removes all matching guff', function () {
|
|
581
596
|
var expected = 'myawesomeword';
|
|
582
|
-
var matcher = matchers_1.term({
|
|
597
|
+
var matcher = (0, matchers_1.term)({
|
|
583
598
|
generate: 'myawesomeword',
|
|
584
599
|
matcher: '\\w+',
|
|
585
600
|
});
|
|
586
|
-
chai_1.expect(matchers_1.isMatcher(matcher)).to.eq(true);
|
|
587
|
-
chai_1.expect(matchers_1.extractPayload(matcher)).to.eql(expected);
|
|
601
|
+
(0, chai_1.expect)((0, matchers_1.isMatcher)(matcher)).to.eq(true);
|
|
602
|
+
(0, chai_1.expect)((0, matchers_1.extractPayload)(matcher)).to.eql(expected);
|
|
588
603
|
});
|
|
589
604
|
});
|
|
590
605
|
describe('when given a complex nested object with matchers', function () {
|
|
591
606
|
it('removes all matching guff', function () {
|
|
592
|
-
var o = matchers_1.somethingLike({
|
|
607
|
+
var o = (0, matchers_1.somethingLike)({
|
|
593
608
|
stringMatcher: {
|
|
594
|
-
awesomeSetting: matchers_1.somethingLike('a string'),
|
|
609
|
+
awesomeSetting: (0, matchers_1.somethingLike)('a string'),
|
|
595
610
|
},
|
|
596
611
|
anotherStringMatcher: {
|
|
597
612
|
nestedSetting: {
|
|
598
|
-
anotherStringMatcherSubSetting: matchers_1.somethingLike(true),
|
|
613
|
+
anotherStringMatcherSubSetting: (0, matchers_1.somethingLike)(true),
|
|
599
614
|
},
|
|
600
|
-
anotherSetting: matchers_1.term({ generate: 'this', matcher: 'this|that' }),
|
|
615
|
+
anotherSetting: (0, matchers_1.term)({ generate: 'this', matcher: 'this|that' }),
|
|
601
616
|
},
|
|
602
617
|
arrayMatcher: {
|
|
603
|
-
lotsOfValues: matchers_1.eachLike('useful', { min: 3 }),
|
|
618
|
+
lotsOfValues: (0, matchers_1.eachLike)('useful', { min: 3 }),
|
|
604
619
|
},
|
|
605
620
|
arrayOfMatchers: {
|
|
606
|
-
lotsOfValues: matchers_1.eachLike({
|
|
621
|
+
lotsOfValues: (0, matchers_1.eachLike)({
|
|
607
622
|
foo: 'bar',
|
|
608
|
-
baz: matchers_1.somethingLike('bat'),
|
|
623
|
+
baz: (0, matchers_1.somethingLike)('bat'),
|
|
609
624
|
}, { min: 3 }),
|
|
610
625
|
},
|
|
611
626
|
});
|
|
@@ -639,7 +654,7 @@ describe('Matcher', function () {
|
|
|
639
654
|
],
|
|
640
655
|
},
|
|
641
656
|
};
|
|
642
|
-
chai_1.expect(matchers_1.extractPayload(o)).to.deep.equal(expected);
|
|
657
|
+
(0, chai_1.expect)((0, matchers_1.extractPayload)(o)).to.deep.equal(expected);
|
|
643
658
|
});
|
|
644
659
|
});
|
|
645
660
|
});
|