@pact-foundation/pact 16.3.0 → 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.
Files changed (216) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +6 -2
  4. package/package.json +25 -28
  5. package/src/common/graphQL/configurationError.js +2 -22
  6. package/src/common/graphQL/configurationError.js.map +1 -1
  7. package/src/common/graphQL/graphQL.d.ts +2 -2
  8. package/src/common/graphQL/graphQL.js +11 -14
  9. package/src/common/graphQL/graphQL.js.map +1 -1
  10. package/src/common/graphQL/graphQLQueryError.js +2 -22
  11. package/src/common/graphQL/graphQLQueryError.js.map +1 -1
  12. package/src/common/logger.js +9 -9
  13. package/src/common/logger.js.map +1 -1
  14. package/src/common/matchingRules.d.ts +1 -1
  15. package/src/common/matchingRules.js +21 -21
  16. package/src/common/matchingRules.js.map +1 -1
  17. package/src/common/net.js +36 -42
  18. package/src/common/net.js.map +1 -1
  19. package/src/common/net.spec.js +41 -53
  20. package/src/common/net.spec.js.map +1 -1
  21. package/src/common/request.js +33 -82
  22. package/src/common/request.js.map +1 -1
  23. package/src/common/request.spec.js +26 -26
  24. package/src/common/request.spec.js.map +1 -1
  25. package/src/common/spec.js +3 -4
  26. package/src/common/spec.js.map +1 -1
  27. package/src/dsl/apolloGraphql.js +7 -25
  28. package/src/dsl/apolloGraphql.js.map +1 -1
  29. package/src/dsl/apolloGraphql.spec.js +21 -18
  30. package/src/dsl/apolloGraphql.spec.js.map +1 -1
  31. package/src/dsl/graphql.d.ts +2 -2
  32. package/src/dsl/graphql.js +29 -48
  33. package/src/dsl/graphql.js.map +1 -1
  34. package/src/dsl/graphql.spec.js +81 -66
  35. package/src/dsl/graphql.spec.js.map +1 -1
  36. package/src/dsl/interaction.d.ts +2 -2
  37. package/src/dsl/interaction.js +41 -48
  38. package/src/dsl/interaction.js.map +1 -1
  39. package/src/dsl/interaction.spec.js +77 -70
  40. package/src/dsl/interaction.spec.js.map +1 -1
  41. package/src/dsl/matchers.d.ts +1 -1
  42. package/src/dsl/matchers.js +19 -31
  43. package/src/dsl/matchers.js.map +1 -1
  44. package/src/dsl/matchers.spec.js +199 -208
  45. package/src/dsl/matchers.spec.js.map +1 -1
  46. package/src/dsl/message.d.ts +3 -3
  47. package/src/dsl/options.d.ts +3 -3
  48. package/src/dsl/verifier/proxy/hooks.d.ts +2 -2
  49. package/src/dsl/verifier/proxy/hooks.js +42 -112
  50. package/src/dsl/verifier/proxy/hooks.js.map +1 -1
  51. package/src/dsl/verifier/proxy/hooks.spec.js +84 -199
  52. package/src/dsl/verifier/proxy/hooks.spec.js.map +1 -1
  53. package/src/dsl/verifier/proxy/messages.d.ts +2 -2
  54. package/src/dsl/verifier/proxy/messages.js +88 -106
  55. package/src/dsl/verifier/proxy/messages.js.map +1 -1
  56. package/src/dsl/verifier/proxy/parseBody.d.ts +1 -1
  57. package/src/dsl/verifier/proxy/parseBody.js +2 -2
  58. package/src/dsl/verifier/proxy/parseBody.js.map +1 -1
  59. package/src/dsl/verifier/proxy/parseBody.spec.js +31 -76
  60. package/src/dsl/verifier/proxy/parseBody.spec.js.map +1 -1
  61. package/src/dsl/verifier/proxy/proxy.d.ts +2 -2
  62. package/src/dsl/verifier/proxy/proxy.js +22 -26
  63. package/src/dsl/verifier/proxy/proxy.js.map +1 -1
  64. package/src/dsl/verifier/proxy/proxy.spec.js +14 -14
  65. package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -1
  66. package/src/dsl/verifier/proxy/proxyRequest.d.ts +3 -3
  67. package/src/dsl/verifier/proxy/proxyRequest.js +7 -7
  68. package/src/dsl/verifier/proxy/proxyRequest.js.map +1 -1
  69. package/src/dsl/verifier/proxy/proxyRequest.spec.js +49 -64
  70. package/src/dsl/verifier/proxy/proxyRequest.spec.js.map +1 -1
  71. package/src/dsl/verifier/proxy/stateHandler/setupStates.d.ts +3 -3
  72. package/src/dsl/verifier/proxy/stateHandler/setupStates.js +14 -18
  73. package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -1
  74. package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +76 -159
  75. package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -1
  76. package/src/dsl/verifier/proxy/stateHandler/stateHandler.d.ts +2 -2
  77. package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +23 -72
  78. package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -1
  79. package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +37 -85
  80. package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -1
  81. package/src/dsl/verifier/proxy/tracer.d.ts +1 -1
  82. package/src/dsl/verifier/proxy/tracer.js +42 -35
  83. package/src/dsl/verifier/proxy/tracer.js.map +1 -1
  84. package/src/dsl/verifier/proxy/types.d.ts +5 -5
  85. package/src/dsl/verifier/types.d.ts +3 -3
  86. package/src/dsl/verifier/verifier.d.ts +1 -1
  87. package/src/dsl/verifier/verifier.js +49 -56
  88. package/src/dsl/verifier/verifier.js.map +1 -1
  89. package/src/dsl/verifier/verifier.spec.js +76 -93
  90. package/src/dsl/verifier/verifier.spec.js.map +1 -1
  91. package/src/errors/configurationError.js +2 -22
  92. package/src/errors/configurationError.js.map +1 -1
  93. package/src/errors/graphQLQueryError.js +2 -22
  94. package/src/errors/graphQLQueryError.js.map +1 -1
  95. package/src/errors/matcherError.js +2 -22
  96. package/src/errors/matcherError.js.map +1 -1
  97. package/src/errors/verificationError.js +2 -22
  98. package/src/errors/verificationError.js.map +1 -1
  99. package/src/httpPact/ffi.d.ts +2 -2
  100. package/src/httpPact/ffi.js +28 -29
  101. package/src/httpPact/ffi.js.map +1 -1
  102. package/src/httpPact/ffi.spec.js +30 -31
  103. package/src/httpPact/ffi.spec.js.map +1 -1
  104. package/src/httpPact/index.d.ts +3 -3
  105. package/src/httpPact/index.js +92 -149
  106. package/src/httpPact/index.js.map +1 -1
  107. package/src/httpPact/index.spec.js +75 -125
  108. package/src/httpPact/index.spec.js.map +1 -1
  109. package/src/httpPact/tracing.js +20 -28
  110. package/src/httpPact/tracing.js.map +1 -1
  111. package/src/index.js +1 -1
  112. package/src/index.js.map +1 -1
  113. package/src/messageConsumerPact.d.ts +3 -3
  114. package/src/messageConsumerPact.js +50 -51
  115. package/src/messageConsumerPact.js.map +1 -1
  116. package/src/messageConsumerPact.spec.js +50 -49
  117. package/src/messageConsumerPact.spec.js.map +1 -1
  118. package/src/messageProviderPact.d.ts +3 -3
  119. package/src/messageProviderPact.js +68 -85
  120. package/src/messageProviderPact.js.map +1 -1
  121. package/src/messageProviderPact.spec.js +75 -66
  122. package/src/messageProviderPact.spec.js.map +1 -1
  123. package/src/pact.integration.spec.js +250 -268
  124. package/src/pact.integration.spec.js.map +1 -1
  125. package/src/v3/display.d.ts +1 -1
  126. package/src/v3/display.js +44 -58
  127. package/src/v3/display.js.map +1 -1
  128. package/src/v3/ffi.d.ts +2 -2
  129. package/src/v3/ffi.js +18 -16
  130. package/src/v3/ffi.js.map +1 -1
  131. package/src/v3/ffi.spec.d.ts +1 -0
  132. package/src/v3/ffi.spec.js +50 -0
  133. package/src/v3/ffi.spec.js.map +1 -0
  134. package/src/v3/graphql/graphQL.d.ts +4 -4
  135. package/src/v3/graphql/graphQL.js +50 -75
  136. package/src/v3/graphql/graphQL.js.map +1 -1
  137. package/src/v3/matchers.d.ts +2 -2
  138. package/src/v3/matchers.js +112 -147
  139. package/src/v3/matchers.js.map +1 -1
  140. package/src/v3/matchers.spec.js +168 -187
  141. package/src/v3/matchers.spec.js.map +1 -1
  142. package/src/v3/pact.d.ts +2 -2
  143. package/src/v3/pact.js +103 -151
  144. package/src/v3/pact.js.map +1 -1
  145. package/src/v3/types.d.ts +1 -1
  146. package/src/v3/xml/xmlBuilder.d.ts +1 -3
  147. package/src/v3/xml/xmlBuilder.js +7 -9
  148. package/src/v3/xml/xmlBuilder.js.map +1 -1
  149. package/src/v3/xml/xmlElement.d.ts +2 -2
  150. package/src/v3/xml/xmlElement.js +24 -41
  151. package/src/v3/xml/xmlElement.js.map +1 -1
  152. package/src/v3/xml/xmlElement.spec.js +23 -25
  153. package/src/v3/xml/xmlElement.spec.js.map +1 -1
  154. package/src/v3/xml/xmlNode.js +2 -5
  155. package/src/v3/xml/xmlNode.js.map +1 -1
  156. package/src/v3/xml/xmlText.d.ts +1 -1
  157. package/src/v3/xml/xmlText.js +9 -25
  158. package/src/v3/xml/xmlText.js.map +1 -1
  159. package/src/v4/graphql/graphQLInteractionWithRequest.d.ts +4 -4
  160. package/src/v4/graphql/graphQLInteractionWithRequest.js +21 -17
  161. package/src/v4/graphql/graphQLInteractionWithRequest.js.map +1 -1
  162. package/src/v4/graphql/graphQLRequestBuilder.d.ts +3 -3
  163. package/src/v4/graphql/graphQLRequestBuilder.js +18 -20
  164. package/src/v4/graphql/graphQLRequestBuilder.js.map +1 -1
  165. package/src/v4/graphql/index.d.ts +6 -6
  166. package/src/v4/graphql/index.js +21 -17
  167. package/src/v4/graphql/index.js.map +1 -1
  168. package/src/v4/graphql/types.d.ts +5 -5
  169. package/src/v4/http/index.d.ts +2 -2
  170. package/src/v4/http/index.js +48 -93
  171. package/src/v4/http/index.js.map +1 -1
  172. package/src/v4/http/interactionWithCompleteRequest.d.ts +4 -7
  173. package/src/v4/http/interactionWithCompleteRequest.js +6 -10
  174. package/src/v4/http/interactionWithCompleteRequest.js.map +1 -1
  175. package/src/v4/http/interactionWithPlugin.d.ts +3 -3
  176. package/src/v4/http/interactionWithPlugin.js +14 -11
  177. package/src/v4/http/interactionWithPlugin.js.map +1 -1
  178. package/src/v4/http/interactionWithPluginRequest.d.ts +2 -2
  179. package/src/v4/http/interactionWithPluginRequest.js +11 -8
  180. package/src/v4/http/interactionWithPluginRequest.js.map +1 -1
  181. package/src/v4/http/interactionWithPluginResponse.d.ts +2 -2
  182. package/src/v4/http/interactionWithPluginResponse.js +10 -48
  183. package/src/v4/http/interactionWithPluginResponse.js.map +1 -1
  184. package/src/v4/http/interactionWithRequest.d.ts +2 -2
  185. package/src/v4/http/interactionWithRequest.js +11 -8
  186. package/src/v4/http/interactionWithRequest.js.map +1 -1
  187. package/src/v4/http/interactionWithResponse.d.ts +2 -2
  188. package/src/v4/http/interactionWithResponse.js +10 -48
  189. package/src/v4/http/interactionWithResponse.js.map +1 -1
  190. package/src/v4/http/requestBuilder.d.ts +3 -3
  191. package/src/v4/http/requestBuilder.js +32 -34
  192. package/src/v4/http/requestBuilder.js.map +1 -1
  193. package/src/v4/http/requestWithPluginBuilder.d.ts +2 -2
  194. package/src/v4/http/requestWithPluginBuilder.js +26 -46
  195. package/src/v4/http/requestWithPluginBuilder.js.map +1 -1
  196. package/src/v4/http/responseBuilder.d.ts +3 -3
  197. package/src/v4/http/responseBuilder.js +24 -25
  198. package/src/v4/http/responseBuilder.js.map +1 -1
  199. package/src/v4/http/responseWithPluginBuilder.d.ts +1 -1
  200. package/src/v4/http/responseWithPluginBuilder.js +5 -25
  201. package/src/v4/http/responseWithPluginBuilder.js.map +1 -1
  202. package/src/v4/http/types.d.ts +3 -2
  203. package/src/v4/http/unconfiguredInteraction.d.ts +6 -5
  204. package/src/v4/http/unconfiguredInteraction.js +31 -26
  205. package/src/v4/http/unconfiguredInteraction.js.map +1 -1
  206. package/src/v4/index.d.ts +4 -4
  207. package/src/v4/index.js +31 -35
  208. package/src/v4/index.js.map +1 -1
  209. package/src/v4/message/asynchronousMessage.d.ts +7 -6
  210. package/src/v4/message/asynchronousMessage.js +157 -190
  211. package/src/v4/message/asynchronousMessage.js.map +1 -1
  212. package/src/v4/message/index.d.ts +7 -6
  213. package/src/v4/message/index.js +188 -217
  214. package/src/v4/message/index.js.map +1 -1
  215. package/src/v4/message/types.d.ts +5 -3
  216. package/src/v4/types.d.ts +3 -3
@@ -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
- var chai = __importStar(require("chai"));
48
- var MatchersV3 = __importStar(require("./matchers"));
49
- var expect = chai.expect;
50
- describe('V3 Matchers', function () {
51
- it('compiles with nested examples from issue 1054', function () {
52
- var f = { a: 'working example' };
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(__assign({}, f));
43
+ MatchersV3.like({ ...f });
55
44
  MatchersV3.like(Object.freeze(f));
56
- var r = { id: 'some guid', foo: { a: 'example' } };
45
+ const r = { id: 'some guid', foo: { a: 'example' } };
57
46
  MatchersV3.like(r);
58
- MatchersV3.like(__assign({}, r));
47
+ MatchersV3.like({ ...r });
59
48
  MatchersV3.like(Object.freeze(f));
60
49
  MatchersV3.reify(r);
61
50
  });
62
- describe('#like', function () {
63
- it('returns a JSON representation of a like matcher', function () {
64
- var result = MatchersV3.like({
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', function () {
76
- it('returns a JSON representation of an eachKeyLike matcher', function () {
77
- var result = MatchersV3.eachKeyLike('004', {
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', function () {
91
- describe('with no min', function () {
92
- it('returns a JSON representation of an eachLike matcher', function () {
93
- var result = MatchersV3.eachLike({
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', function () {
108
- it('returns a JSON representation of an eachLike matcher', function () {
109
- var result = MatchersV3.eachLike({
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', function () {
131
- describe('with no examples', function () {
132
- it('returns a JSON representation of an atLeastOneLike matcher', function () {
133
- var result = MatchersV3.atLeastOneLike({
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', function () {
148
- it('returns a JSON representation of an atLeastOneLike matcher with the correct number of examples', function () {
149
- var result = MatchersV3.atLeastOneLike({
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', function () {
161
- describe('with no examples', function () {
162
- it('returns a JSON representation of an atLeastLike matcher', function () {
163
- var result = MatchersV3.atLeastLike({
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', function () {
174
- it('returns a JSON representation of an atLeastLike matcher with the correct number of examples', function () {
175
- var result = MatchersV3.atLeastLike({
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', function () {
186
- expect(function () { return 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.');
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', function () {
190
- describe('with no examples', function () {
191
- it('returns a JSON representation of an atMostLike matcher', function () {
192
- var result = MatchersV3.atMostLike({
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', function () {
203
- it('returns a JSON representation of an atMostLike matcher with the correct number of examples', function () {
204
- var result = MatchersV3.atMostLike({
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', function () {
215
- expect(function () { return 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.');
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', function () {
219
- describe('with no examples', function () {
220
- it('returns a JSON representation of an constrainedArrayLike matcher', function () {
221
- var result = MatchersV3.constrainedArrayLike({
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', function () {
233
- it('returns a JSON representation of an constrainedArrayLike matcher with the correct number of examples', function () {
234
- var result = MatchersV3.constrainedArrayLike({
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', function () {
246
- expect(function () {
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', function () {
251
- expect(function () {
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', function () {
257
- it('returns a JSON representation of an integer matcher', function () {
258
- var result = MatchersV3.integer(100);
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', function () {
265
- it('returns a JSON representation of an integer matcher', function () {
266
- var result = MatchersV3.integer(0);
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', function () {
274
- it('also includes a random integer generator', function () {
275
- var result = MatchersV3.integer();
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', function () {
285
- it('returns a JSON representation of an decimal matcher', function () {
286
- var result = MatchersV3.decimal(100.3);
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', function () {
293
- it('returns a JSON representation of an integer matcher', function () {
294
- var result = MatchersV3.decimal(0.0);
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', function () {
302
- it('also includes a random decimal generator', function () {
303
- var result = MatchersV3.decimal();
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', function () {
313
- it('returns a JSON representation of an number matcher', function () {
314
- var result = MatchersV3.number(100.3);
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', function () {
321
- it('also includes a random integer generator', function () {
322
- var result = MatchersV3.number();
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', function () {
332
- it('returns a JSON representation of a like matcher', function () {
333
- var result = MatchersV3.boolean(true);
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', function () {
341
- it('returns a JSON representation of a like matcher', function () {
342
- var result = MatchersV3.string('true');
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', function () {
350
- it('returns a JSON representation of a regex matcher', function () {
351
- var result = MatchersV3.regex('\\d+', '1234');
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', function () {
359
- it('returns a JSON representation of a regex matcher', function () {
360
- var result = MatchersV3.regex(/\d+/, '1234');
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', function () {
370
- it('returns a JSON representation of an equality matcher', function () {
371
- var result = MatchersV3.equal('true');
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', function () {
379
- describe('when an example is given', function () {
380
- it('returns a JSON representation of a datetime matcher', function () {
381
- var result = MatchersV3.datetime("yyyy-MM-dd'T'HH:mm:ss.SSSX", '2016-02-11T09:46:56.023Z');
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', function () {
390
- it('throws an error', function () {
391
- expect(function () {
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', function () {
398
- describe('when an example is given', function () {
399
- it('returns a JSON representation of a time matcher', function () {
400
- var result = MatchersV3.time('HH:mm:ss', '09:46:56');
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', function () {
409
- it('throws an error', function () {
410
- expect(function () { return MatchersV3.time('HH:mm:ss', ''); }).to.throw('you must provide an example time');
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', function () {
415
- describe('when an example is given', function () {
416
- it('returns a JSON representation of a date matcher', function () {
417
- var result = MatchersV3.date('yyyy-MM-dd', '2016-02-11');
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', function () {
426
- it('throws an error', function () {
427
- expect(function () { return MatchersV3.date('yyyy-MM-dd', ''); }).to.throw('you must provide an example date');
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', function () {
432
- it('returns a JSON representation of an include matcher', function () {
433
- var result = MatchersV3.includes('true');
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', function () {
441
- it('returns a JSON representation of an null matcher', function () {
442
- var result = MatchersV3.nullValue();
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', function () {
450
- it('returns a JSON representation of a regex matcher for the URL', function () {
451
- var result = MatchersV3.url2('http://localhost:8080', [
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', function () {
464
- it('returns a JSON representation of a regex matcher for the URL', function () {
465
- var result = MatchersV3.url2('http://localhost:8080', [
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', function () {
479
- it('returns a JSON representation of a regex matcher for the URL', function () {
480
- var result = MatchersV3.url2('http://localhost:8080', [
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', function () {
494
- it('returns regex matcher and a MockServerURL generator', function () {
495
- var result = MatchersV3.url([
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', function () {
512
- it('returns a JSON representation of an regex matcher for UUIDs', function () {
513
- var result = MatchersV3.uuid('ba4bd1bc-5556-11eb-9286-d71bc5b507be');
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', function () {
521
- expect(function () { return MatchersV3.uuid('not a uuid'); }).to.throw();
522
- expect(function () { return MatchersV3.uuid('ba4bd1bc-5556-11eb-9286'); }).to.throw();
523
- expect(function () {
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', function () {
528
- var result = MatchersV3.uuid();
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', function () {
538
- describe('when given an object with no matchers', function () {
539
- var object = {
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', function () {
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', function () {
553
- var object = {
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', function () {
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', function () {
568
- var someMatchers = {
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
- var expected = {
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', function () {
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', function () {
599
- it('removes all matching guff', function () {
600
- var expected = 'myawesomeword';
601
- var matcher = MatchersV3.regex('\\w+', 'myawesomeword');
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', function () {
607
- it('removes all matching guff', function () {
608
- var o = MatchersV3.like({
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
- var expected = {
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"', function () {
662
- it('should not be isMatcher"', function () {
663
- var resultMatcher = MatchersV3.like({
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
- var result = MatchersV3.reify(resultMatcher);
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' }],