@pact-foundation/pact 16.3.1 → 16.5.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 +23 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +22 -12
- package/package.json +26 -47
- package/scripts/ci/build-and-test.sh +0 -3
- package/scripts/install-plugins.js +104 -0
- 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 +7 -1
- package/src/common/matchingRules.js +42 -22
- 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 +39 -87
- 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 +29 -73
- 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 -58
- 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 +92 -117
- 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 +109 -132
- package/src/dsl/interaction.spec.js.map +1 -1
- package/src/dsl/matchers.d.ts +2 -3
- package/src/dsl/matchers.js +19 -31
- package/src/dsl/matchers.js.map +1 -1
- package/src/dsl/matchers.spec.js +279 -289
- 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 +86 -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 +3 -3
- package/src/dsl/verifier/proxy/parseBody.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.spec.js +35 -113
- 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 +11 -53
- 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 +54 -104
- 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 -193
- 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 -122
- 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 +5 -1
- package/src/dsl/verifier/verifier.js +53 -60
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/dsl/verifier/verifier.spec.js +84 -151
- 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 +40 -83
- 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 +102 -195
- 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.d.ts +25 -25
- package/src/index.js +29 -29
- package/src/index.js.map +1 -1
- package/src/messageConsumerPact.d.ts +5 -5
- package/src/messageConsumerPact.js +59 -53
- package/src/messageConsumerPact.js.map +1 -1
- package/src/messageConsumerPact.spec.js +55 -97
- 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 +96 -123
- package/src/messageProviderPact.spec.js.map +1 -1
- package/src/pact.integration.spec.js +242 -351
- 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 +20 -16
- package/src/v3/ffi.js.map +1 -1
- package/src/v3/ffi.spec.js +7 -42
- 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/graphql/index.d.ts +1 -1
- package/src/v3/graphql/index.js +1 -1
- package/src/v3/graphql/index.js.map +1 -1
- package/src/v3/index.d.ts +4 -12
- package/src/v3/index.js +4 -12
- package/src/v3/index.js.map +1 -1
- package/src/v3/matchers.d.ts +15 -3
- package/src/v3/matchers.js +131 -148
- package/src/v3/matchers.js.map +1 -1
- package/src/v3/matchers.spec.js +281 -232
- package/src/v3/matchers.spec.js.map +1 -1
- package/src/v3/pact.d.ts +2 -2
- package/src/v3/pact.js +108 -151
- package/src/v3/pact.js.map +1 -1
- package/src/v3/pact.spec.js +94 -0
- package/src/v3/pact.spec.js.map +1 -0
- package/src/v3/types.d.ts +19 -3
- package/src/v3/types.js +22 -1
- package/src/v3/types.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 +53 -93
- package/src/v4/http/index.js.map +1 -1
- package/src/v4/http/index.spec.d.ts +1 -0
- package/src/v4/http/index.spec.js +73 -0
- package/src/v4/http/index.spec.js.map +1 -0
- 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 +4 -3
- package/src/v4/http/interactionWithPluginRequest.js +17 -9
- 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 +4 -3
- package/src/v4/http/interactionWithRequest.js +17 -9
- package/src/v4/http/interactionWithRequest.js.map +1 -1
- package/src/v4/http/interactionWithRequest.spec.d.ts +1 -0
- package/src/v4/http/interactionWithRequest.spec.js +82 -0
- package/src/v4/http/interactionWithRequest.spec.js.map +1 -0
- 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 +4 -3
- package/src/v4/http/requestBuilder.js +36 -34
- package/src/v4/http/requestBuilder.js.map +1 -1
- package/src/v4/http/requestBuilder.spec.d.ts +1 -0
- package/src/v4/http/requestBuilder.spec.js +42 -0
- package/src/v4/http/requestBuilder.spec.js.map +1 -0
- package/src/v4/http/requestWithPluginBuilder.d.ts +3 -2
- package/src/v4/http/requestWithPluginBuilder.js +30 -46
- package/src/v4/http/requestWithPluginBuilder.js.map +1 -1
- package/src/v4/http/requestWithPluginBuilder.spec.d.ts +1 -0
- package/src/v4/http/requestWithPluginBuilder.spec.js +34 -0
- package/src/v4/http/requestWithPluginBuilder.spec.js.map +1 -0
- package/src/v4/http/responseBuilder.d.ts +4 -3
- package/src/v4/http/responseBuilder.js +28 -25
- package/src/v4/http/responseBuilder.js.map +1 -1
- package/src/v4/http/responseBuilder.spec.d.ts +1 -0
- package/src/v4/http/responseBuilder.spec.js +42 -0
- package/src/v4/http/responseBuilder.spec.js.map +1 -0
- 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/responseWithPluginBuilder.spec.d.ts +1 -0
- package/src/v4/http/responseWithPluginBuilder.spec.js +34 -0
- package/src/v4/http/responseWithPluginBuilder.spec.js.map +1 -0
- package/src/v4/http/types.d.ts +13 -4
- 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 +6 -5
- package/src/v4/index.js +32 -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/xml/index.d.ts +4 -0
- package/src/xml/index.js +21 -0
- package/src/xml/index.js.map +1 -0
- package/src/{v3/xml → xml}/xmlBuilder.d.ts +1 -3
- package/src/{v3/xml → xml}/xmlBuilder.js +7 -9
- package/src/xml/xmlBuilder.js.map +1 -0
- package/src/{v3/xml → xml}/xmlElement.d.ts +2 -2
- package/src/xml/xmlElement.js +73 -0
- package/src/xml/xmlElement.js.map +1 -0
- package/src/xml/xmlElement.spec.d.ts +1 -0
- package/src/xml/xmlElement.spec.js +107 -0
- package/src/xml/xmlElement.spec.js.map +1 -0
- package/src/xml/xmlNode.js +7 -0
- package/src/xml/xmlNode.js.map +1 -0
- package/src/{v3/xml → xml}/xmlText.d.ts +1 -1
- package/src/xml/xmlText.js +15 -0
- package/src/xml/xmlText.js.map +1 -0
- package/scripts/install-plugins +0 -106
- package/src/v3/xml/xmlBuilder.js.map +0 -1
- package/src/v3/xml/xmlElement.js +0 -90
- package/src/v3/xml/xmlElement.js.map +0 -1
- package/src/v3/xml/xmlElement.spec.js +0 -113
- package/src/v3/xml/xmlElement.spec.js.map +0 -1
- package/src/v3/xml/xmlNode.js +0 -10
- package/src/v3/xml/xmlNode.js.map +0 -1
- package/src/v3/xml/xmlText.js +0 -31
- package/src/v3/xml/xmlText.js.map +0 -1
- /package/src/v3/{xml/xmlElement.spec.d.ts → pact.spec.d.ts} +0 -0
- /package/src/{v3/xml → xml}/xmlNode.d.ts +0 -0
package/src/v4/message/index.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
@@ -42,20 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
6
|
exports.SynchronousMessageWithResponse = exports.SynchronousMessageWithTransport = exports.SynchronousMessageWithPluginContents = exports.SynchronousMessageWithResponseBuilder = exports.SynchronousMessageWithRequest = exports.SynchronousMessageWithRequestBuilder = exports.SynchronousMessageWithPlugin = exports.UnconfiguredSynchronousMessage = void 0;
|
|
43
7
|
exports.v4SynchronousBodyHandler = v4SynchronousBodyHandler;
|
|
44
8
|
exports.v4AsynchronousBodyHandler = v4AsynchronousBodyHandler;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
9
|
+
const ramda_1 = require("ramda");
|
|
10
|
+
const logger_1 = __importDefault(require("../../common/logger"));
|
|
11
|
+
const matchingRules_1 = require("../../common/matchingRules");
|
|
12
|
+
const configurationError_1 = __importDefault(require("../../errors/configurationError"));
|
|
13
|
+
const display_1 = require("../../v3/display");
|
|
14
|
+
const defaultPactDir = './pacts';
|
|
15
|
+
class UnconfiguredSynchronousMessage {
|
|
16
|
+
pact;
|
|
17
|
+
interaction;
|
|
18
|
+
opts;
|
|
19
|
+
cleanupFn;
|
|
20
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
53
21
|
this.pact = pact;
|
|
54
22
|
this.interaction = interaction;
|
|
55
23
|
this.opts = opts;
|
|
56
24
|
this.cleanupFn = cleanupFn;
|
|
57
25
|
}
|
|
58
|
-
|
|
26
|
+
given(state, parameters) {
|
|
59
27
|
if (parameters) {
|
|
60
28
|
this.interaction.givenWithParams(state, JSON.stringify(parameters));
|
|
61
29
|
}
|
|
@@ -63,149 +31,169 @@ var UnconfiguredSynchronousMessage = /** @class */ (function () {
|
|
|
63
31
|
this.interaction.given(state);
|
|
64
32
|
}
|
|
65
33
|
return this;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (pending === void 0) { pending = true; }
|
|
34
|
+
}
|
|
35
|
+
pending(pending = true) {
|
|
69
36
|
this.interaction.setPending(pending);
|
|
70
37
|
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
38
|
+
}
|
|
39
|
+
comment(comment) {
|
|
73
40
|
if (typeof comment === 'string') {
|
|
74
41
|
this.interaction.addTextComment(comment);
|
|
75
42
|
return this;
|
|
76
43
|
}
|
|
77
44
|
this.interaction.setComment(comment.key, comment.value);
|
|
78
45
|
return this;
|
|
79
|
-
}
|
|
80
|
-
|
|
46
|
+
}
|
|
47
|
+
testName(name) {
|
|
81
48
|
this.interaction.setInteractionTestName(name);
|
|
82
49
|
return this;
|
|
83
|
-
}
|
|
84
|
-
|
|
50
|
+
}
|
|
51
|
+
reference(group, name, value) {
|
|
52
|
+
this.interaction.addInteractionReference(group, name, value);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
usingPlugin(config) {
|
|
85
56
|
this.pact.addPlugin(config.plugin, config.version);
|
|
86
57
|
return new SynchronousMessageWithPlugin(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
87
|
-
}
|
|
88
|
-
|
|
58
|
+
}
|
|
59
|
+
withRequest(builder) {
|
|
89
60
|
builder(new SynchronousMessageWithRequestBuilder(this.pact, this.interaction, this.opts));
|
|
90
61
|
return new SynchronousMessageWithRequest(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
94
64
|
exports.UnconfiguredSynchronousMessage = UnconfiguredSynchronousMessage;
|
|
95
|
-
|
|
96
|
-
|
|
65
|
+
class SynchronousMessageWithPlugin {
|
|
66
|
+
pact;
|
|
67
|
+
interaction;
|
|
68
|
+
opts;
|
|
69
|
+
cleanupFn;
|
|
70
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
97
71
|
this.pact = pact;
|
|
98
72
|
this.interaction = interaction;
|
|
99
73
|
this.opts = opts;
|
|
100
74
|
this.cleanupFn = cleanupFn;
|
|
101
75
|
}
|
|
102
|
-
|
|
76
|
+
usingPlugin(config) {
|
|
103
77
|
this.pact.addPlugin(config.plugin, config.version);
|
|
104
78
|
return this;
|
|
105
|
-
}
|
|
106
|
-
|
|
79
|
+
}
|
|
80
|
+
withPluginContents(contents, contentType) {
|
|
107
81
|
this.interaction.withPluginRequestResponseInteractionContents(contentType, contents);
|
|
108
82
|
return new SynchronousMessageWithPluginContents(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
112
85
|
exports.SynchronousMessageWithPlugin = SynchronousMessageWithPlugin;
|
|
113
|
-
|
|
114
|
-
|
|
86
|
+
class SynchronousMessageWithRequestBuilder {
|
|
87
|
+
pact;
|
|
88
|
+
interaction;
|
|
89
|
+
opts;
|
|
90
|
+
constructor(pact, interaction, opts) {
|
|
115
91
|
this.pact = pact;
|
|
116
92
|
this.interaction = interaction;
|
|
117
93
|
this.opts = opts;
|
|
118
94
|
}
|
|
119
|
-
|
|
95
|
+
withContent(contentType, body) {
|
|
120
96
|
this.interaction.withRequestBinaryContents(body, contentType);
|
|
121
97
|
return this;
|
|
122
|
-
}
|
|
123
|
-
|
|
98
|
+
}
|
|
99
|
+
withJSONContent(content) {
|
|
124
100
|
if ((0, ramda_1.isEmpty)(content)) {
|
|
125
101
|
throw new configurationError_1.default('You must provide a valid JSON document or primitive for the Message.');
|
|
126
102
|
}
|
|
127
103
|
this.interaction.withRequestContents(JSON.stringify(content), 'application/json');
|
|
128
104
|
return this;
|
|
129
|
-
}
|
|
130
|
-
|
|
105
|
+
}
|
|
106
|
+
withMatchingRules(rules) {
|
|
131
107
|
(0, matchingRules_1.validateRules)(rules);
|
|
132
|
-
|
|
108
|
+
const ffiRules = (0, matchingRules_1.convertRulesToFFI)(rules);
|
|
133
109
|
this.interaction.withRequestMatchingRules(JSON.stringify(ffiRules));
|
|
134
110
|
return this;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
}());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
138
113
|
exports.SynchronousMessageWithRequestBuilder = SynchronousMessageWithRequestBuilder;
|
|
139
|
-
|
|
140
|
-
|
|
114
|
+
class SynchronousMessageWithRequest {
|
|
115
|
+
pact;
|
|
116
|
+
interaction;
|
|
117
|
+
opts;
|
|
118
|
+
cleanupFn;
|
|
119
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
141
120
|
this.pact = pact;
|
|
142
121
|
this.interaction = interaction;
|
|
143
122
|
this.opts = opts;
|
|
144
123
|
this.cleanupFn = cleanupFn;
|
|
145
124
|
}
|
|
146
|
-
|
|
125
|
+
withResponse(builder) {
|
|
147
126
|
builder(new SynchronousMessageWithResponseBuilder(this.pact, this.interaction, this.opts));
|
|
148
127
|
return new SynchronousMessageWithResponse(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
}());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
152
130
|
exports.SynchronousMessageWithRequest = SynchronousMessageWithRequest;
|
|
153
|
-
|
|
154
|
-
|
|
131
|
+
class SynchronousMessageWithResponseBuilder {
|
|
132
|
+
pact;
|
|
133
|
+
interaction;
|
|
134
|
+
opts;
|
|
135
|
+
constructor(pact, interaction, opts) {
|
|
155
136
|
this.pact = pact;
|
|
156
137
|
this.interaction = interaction;
|
|
157
138
|
this.opts = opts;
|
|
158
139
|
}
|
|
159
|
-
|
|
160
|
-
var _this = this;
|
|
140
|
+
withMetadata(metadata) {
|
|
161
141
|
if ((0, ramda_1.isEmpty)(metadata)) {
|
|
162
142
|
throw new configurationError_1.default('You must provide valid metadata for the Message, or none at all');
|
|
163
143
|
}
|
|
164
|
-
(0, ramda_1.forEachObjIndexed)(
|
|
165
|
-
|
|
144
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
145
|
+
this.interaction.withMetadata(`${k}`, JSON.stringify(v));
|
|
166
146
|
}, metadata);
|
|
167
147
|
return this;
|
|
168
|
-
}
|
|
169
|
-
|
|
148
|
+
}
|
|
149
|
+
withContent(contentType, body) {
|
|
170
150
|
this.interaction.withResponseBinaryContents(body, contentType);
|
|
171
151
|
return this;
|
|
172
|
-
}
|
|
173
|
-
|
|
152
|
+
}
|
|
153
|
+
withJSONContent(content) {
|
|
174
154
|
if ((0, ramda_1.isEmpty)(content)) {
|
|
175
155
|
throw new configurationError_1.default('You must provide a valid JSON document or primitive for the Message.');
|
|
176
156
|
}
|
|
177
157
|
this.interaction.withResponseContents(JSON.stringify(content), 'application/json');
|
|
178
158
|
return this;
|
|
179
|
-
}
|
|
180
|
-
|
|
159
|
+
}
|
|
160
|
+
withMatchingRules(rules) {
|
|
181
161
|
(0, matchingRules_1.validateRules)(rules);
|
|
182
|
-
|
|
162
|
+
const ffiRules = (0, matchingRules_1.convertRulesToFFI)(rules);
|
|
183
163
|
this.interaction.withResponseMatchingRules(JSON.stringify(ffiRules));
|
|
184
164
|
return this;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
}());
|
|
165
|
+
}
|
|
166
|
+
}
|
|
188
167
|
exports.SynchronousMessageWithResponseBuilder = SynchronousMessageWithResponseBuilder;
|
|
189
|
-
|
|
190
|
-
|
|
168
|
+
class SynchronousMessageWithPluginContents {
|
|
169
|
+
pact;
|
|
170
|
+
interaction;
|
|
171
|
+
opts;
|
|
172
|
+
cleanupFn;
|
|
173
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
191
174
|
this.pact = pact;
|
|
192
175
|
this.interaction = interaction;
|
|
193
176
|
this.opts = opts;
|
|
194
177
|
this.cleanupFn = cleanupFn;
|
|
195
178
|
}
|
|
196
|
-
|
|
179
|
+
executeTest(integrationTest) {
|
|
197
180
|
return executeNonTransportTest(this.pact, this.opts, this.interaction, integrationTest, this.cleanupFn);
|
|
198
|
-
}
|
|
199
|
-
|
|
181
|
+
}
|
|
182
|
+
startTransport(transport, address, // IP Address or hostname
|
|
200
183
|
config) {
|
|
201
|
-
|
|
184
|
+
const port = this.pact.pactffiCreateMockServerForTransport(address, transport, config ? JSON.stringify(config) : '');
|
|
202
185
|
return new SynchronousMessageWithTransport(this.pact, this.interaction, this.opts, port, address, this.cleanupFn);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
}());
|
|
186
|
+
}
|
|
187
|
+
}
|
|
206
188
|
exports.SynchronousMessageWithPluginContents = SynchronousMessageWithPluginContents;
|
|
207
|
-
|
|
208
|
-
|
|
189
|
+
class SynchronousMessageWithTransport {
|
|
190
|
+
pact;
|
|
191
|
+
interaction;
|
|
192
|
+
opts;
|
|
193
|
+
port;
|
|
194
|
+
address;
|
|
195
|
+
cleanupFn;
|
|
196
|
+
constructor(pact, interaction, opts, port, address, cleanupFn) {
|
|
209
197
|
this.pact = pact;
|
|
210
198
|
this.interaction = interaction;
|
|
211
199
|
this.opts = opts;
|
|
@@ -215,82 +203,73 @@ var SynchronousMessageWithTransport = /** @class */ (function () {
|
|
|
215
203
|
}
|
|
216
204
|
// TODO: this is basically the same as the HTTP variant, except only with a different test function wrapper
|
|
217
205
|
// extract these into smaller, testable chunks and re-use them
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
Response: response.map(function (c) { return ({
|
|
232
|
-
content: c,
|
|
233
|
-
}); }),
|
|
234
|
-
})];
|
|
235
|
-
case 1:
|
|
236
|
-
val = _a.sent();
|
|
237
|
-
return [3 /*break*/, 3];
|
|
238
|
-
case 2:
|
|
239
|
-
e_1 = _a.sent();
|
|
240
|
-
error = e_1;
|
|
241
|
-
return [3 /*break*/, 3];
|
|
242
|
-
case 3:
|
|
243
|
-
matchingResults = this.pact.mockServerMismatches(this.port);
|
|
244
|
-
errors = (0, display_1.filterMissingFeatureFlag)(matchingResults);
|
|
245
|
-
success = this.pact.mockServerMatchedSuccessfully(this.port);
|
|
246
|
-
// Scenario: Pact validation failed
|
|
247
|
-
if (!success && errors.length > 0) {
|
|
248
|
-
errorMessage = 'Test failed for the following reasons:';
|
|
249
|
-
errorMessage += "\n\n ".concat((0, display_1.generateMockServerError)(matchingResults, '\t'));
|
|
250
|
-
cleanup(false, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
251
|
-
// If the tests throws an error, we need to rethrow the error, but print out
|
|
252
|
-
// any additional mock server errors to help the user understand what happened
|
|
253
|
-
// (The proximate cause here is often the HTTP 500 from the mock server,
|
|
254
|
-
// where the HTTP client then throws)
|
|
255
|
-
if (error) {
|
|
256
|
-
logger_1.default.error(errorMessage);
|
|
257
|
-
throw error;
|
|
258
|
-
}
|
|
259
|
-
// Test didn't throw, so we need to ensure the test fails
|
|
260
|
-
return [2 /*return*/, Promise.reject(new Error(errorMessage))];
|
|
261
|
-
}
|
|
262
|
-
// Scenario: test threw an error, but Pact validation was OK (error in client or test)
|
|
263
|
-
if (error) {
|
|
264
|
-
cleanup(false, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
265
|
-
throw error;
|
|
266
|
-
}
|
|
267
|
-
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
268
|
-
cleanup(true, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
269
|
-
return [2 /*return*/, val];
|
|
270
|
-
}
|
|
206
|
+
async executeTest(integrationTest) {
|
|
207
|
+
let val;
|
|
208
|
+
let error;
|
|
209
|
+
try {
|
|
210
|
+
const request = this.interaction.getRequestContents();
|
|
211
|
+
const response = this.interaction.getResponseContents();
|
|
212
|
+
val = await integrationTest({ port: this.port, address: this.address }, {
|
|
213
|
+
Request: {
|
|
214
|
+
content: request,
|
|
215
|
+
},
|
|
216
|
+
Response: response.map((c) => ({
|
|
217
|
+
content: c,
|
|
218
|
+
})),
|
|
271
219
|
});
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
220
|
+
}
|
|
221
|
+
catch (e) {
|
|
222
|
+
error = e instanceof Error ? e : new Error(String(e));
|
|
223
|
+
}
|
|
224
|
+
const matchingResults = this.pact.mockServerMismatches(this.port);
|
|
225
|
+
const errors = (0, display_1.filterMissingFeatureFlag)(matchingResults);
|
|
226
|
+
const success = this.pact.mockServerMatchedSuccessfully(this.port);
|
|
227
|
+
// Scenario: Pact validation failed
|
|
228
|
+
if (!success && errors.length > 0) {
|
|
229
|
+
let errorMessage = 'Test failed for the following reasons:';
|
|
230
|
+
errorMessage += `\n\n ${(0, display_1.generateMockServerError)(matchingResults, '\t')}`;
|
|
231
|
+
cleanup(false, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
232
|
+
// If the tests throws an error, we need to rethrow the error, but print out
|
|
233
|
+
// any additional mock server errors to help the user understand what happened
|
|
234
|
+
// (The proximate cause here is often the HTTP 500 from the mock server,
|
|
235
|
+
// where the HTTP client then throws)
|
|
236
|
+
if (error) {
|
|
237
|
+
logger_1.default.error(errorMessage);
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
// Test didn't throw, so we need to ensure the test fails
|
|
241
|
+
return Promise.reject(new Error(errorMessage));
|
|
242
|
+
}
|
|
243
|
+
// Scenario: test threw an error, but Pact validation was OK (error in client or test)
|
|
244
|
+
if (error) {
|
|
245
|
+
cleanup(false, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
249
|
+
cleanup(true, this.pact, this.opts, this.cleanupFn, this.port, true);
|
|
250
|
+
return val;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
276
253
|
exports.SynchronousMessageWithTransport = SynchronousMessageWithTransport;
|
|
277
|
-
|
|
278
|
-
|
|
254
|
+
class SynchronousMessageWithResponse {
|
|
255
|
+
pact;
|
|
256
|
+
interaction;
|
|
257
|
+
opts;
|
|
258
|
+
cleanupFn;
|
|
259
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
279
260
|
this.pact = pact;
|
|
280
261
|
this.interaction = interaction;
|
|
281
262
|
this.opts = opts;
|
|
282
263
|
this.cleanupFn = cleanupFn;
|
|
283
264
|
}
|
|
284
|
-
|
|
285
|
-
|
|
265
|
+
executeTest(integrationTest) {
|
|
266
|
+
const res = executeNonTransportTest(this.pact, this.opts, this.interaction, integrationTest, this.cleanupFn);
|
|
286
267
|
this.cleanupFn();
|
|
287
268
|
return res;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
}());
|
|
269
|
+
}
|
|
270
|
+
}
|
|
291
271
|
exports.SynchronousMessageWithResponse = SynchronousMessageWithResponse;
|
|
292
|
-
|
|
293
|
-
if (transport === void 0) { transport = false; }
|
|
272
|
+
const cleanup = (success, pact, opts, cleanupFn, port, transport = false) => {
|
|
294
273
|
if (success) {
|
|
295
274
|
if (transport && port) {
|
|
296
275
|
pact.writePactFileForPluginServer(port, opts.dir || defaultPactDir, true);
|
|
@@ -305,49 +284,41 @@ var cleanup = function (success, pact, opts, cleanupFn, port, transport) {
|
|
|
305
284
|
pact.cleanupPlugins();
|
|
306
285
|
cleanupFn();
|
|
307
286
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
throw error;
|
|
336
|
-
}
|
|
337
|
-
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
338
|
-
cleanup(true, pact, opts, cleanupFn);
|
|
339
|
-
return [2 /*return*/, val];
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
}); };
|
|
287
|
+
const executeNonTransportTest = async (pact, opts, interaction, integrationTest, cleanupFn) => {
|
|
288
|
+
let val;
|
|
289
|
+
let error;
|
|
290
|
+
try {
|
|
291
|
+
const request = interaction.getRequestContents();
|
|
292
|
+
const response = interaction.getResponseContents();
|
|
293
|
+
val = await integrationTest({
|
|
294
|
+
Request: {
|
|
295
|
+
content: request,
|
|
296
|
+
},
|
|
297
|
+
Response: response.map((c) => ({
|
|
298
|
+
content: c,
|
|
299
|
+
})),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
error = e instanceof Error ? e : new Error(String(e));
|
|
304
|
+
}
|
|
305
|
+
// Scenario: test threw an error, but Pact validation was OK (error in client or test)
|
|
306
|
+
if (error) {
|
|
307
|
+
cleanup(false, pact, opts, cleanupFn);
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
311
|
+
cleanup(true, pact, opts, cleanupFn);
|
|
312
|
+
return val;
|
|
313
|
+
};
|
|
343
314
|
// bodyHandler takes a synchronous function and returns
|
|
344
315
|
// a wrapped function that accepts a Message and returns a Promise
|
|
345
316
|
function v4SynchronousBodyHandler(handler) {
|
|
346
|
-
return
|
|
347
|
-
|
|
348
|
-
return new Promise(
|
|
317
|
+
return (m) => {
|
|
318
|
+
const body = m.contents.content;
|
|
319
|
+
return new Promise((resolve, reject) => {
|
|
349
320
|
try {
|
|
350
|
-
|
|
321
|
+
const res = handler(body);
|
|
351
322
|
resolve(res);
|
|
352
323
|
}
|
|
353
324
|
catch (e) {
|
|
@@ -359,6 +330,6 @@ function v4SynchronousBodyHandler(handler) {
|
|
|
359
330
|
// bodyHandler takes an asynchronous (promisified) function and returns
|
|
360
331
|
// a wrapped function that accepts a Message and returns a Promise
|
|
361
332
|
function v4AsynchronousBodyHandler(handler) {
|
|
362
|
-
return
|
|
333
|
+
return (m) => handler(m.contents.content);
|
|
363
334
|
}
|
|
364
335
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/message/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/message/index.ts"],"names":[],"mappings":";;;;;;AA6eA,4DAeC;AAID,8DAIC;AAhgBD,iCAAmD;AAEnD,iEAAyC;AACzC,8DAA8E;AAE9E,yFAAiE;AACjE,8CAG0B;AAsB1B,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,MAAa,8BAA8B;IAI7B;IACA;IACA;IACA;IAJZ,YACY,IAAkB,EAClB,WAAuC,EACvC,IAAmB,EACnB,SAAqB;QAHrB,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAA4B;QACvC,SAAI,GAAJ,IAAI,CAAe;QACnB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,KAAK,CAAC,KAAa,EAAE,UAAoB;QACvC,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,OAAO,GAAG,IAAI;QACpB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CA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I,EAAE,SAAS,CAAC,CAAC;IAErC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAWF,uDAAuD;AACvD,kEAAkE;AAClE,SAAgB,wBAAwB,CACtC,OAAsC;IAEtC,OAAO,CAAC,CAAkB,EAAc,EAAE;QACxC,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;QAEhC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,kEAAkE;AAClE,SAAgB,yBAAyB,CACvC,OAA+C;IAE/C,OAAO,CAAC,CAAkB,EAAc,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnyJson, JsonMap } from '../../common/jsonTypes';
|
|
2
|
-
import { Metadata } from '../../dsl/message';
|
|
3
|
-
import { Rules } from '../../v3/types';
|
|
1
|
+
import type { AnyJson, JsonMap } from '../../common/jsonTypes';
|
|
2
|
+
import type { Metadata } from '../../dsl/message';
|
|
3
|
+
import type { Rules } from '../../v3/types';
|
|
4
4
|
export type MessageContents = {
|
|
5
5
|
content: AnyJson | Buffer;
|
|
6
6
|
};
|
|
@@ -36,6 +36,7 @@ export interface V4UnconfiguredSynchronousMessage {
|
|
|
36
36
|
pending(pending?: boolean): V4UnconfiguredSynchronousMessage;
|
|
37
37
|
comment(comment: Comment | CustomComment): V4UnconfiguredSynchronousMessage;
|
|
38
38
|
testName(name: string): V4UnconfiguredSynchronousMessage;
|
|
39
|
+
reference(group: string, name: string, value: string): V4UnconfiguredSynchronousMessage;
|
|
39
40
|
usingPlugin(config: PluginConfig): V4SynchronousMessageWithPlugin;
|
|
40
41
|
withRequest(r: V4MessageRequestBuilderFunc): V4SynchronousMessageWithRequest;
|
|
41
42
|
}
|
|
@@ -75,6 +76,7 @@ export interface V4UnconfiguredAsynchronousMessage {
|
|
|
75
76
|
pending(pending?: boolean): V4UnconfiguredAsynchronousMessage;
|
|
76
77
|
comment(comment: Comment | CustomComment): V4UnconfiguredAsynchronousMessage;
|
|
77
78
|
testName(name: string): V4UnconfiguredAsynchronousMessage;
|
|
79
|
+
reference(group: string, name: string, value: string): V4UnconfiguredAsynchronousMessage;
|
|
78
80
|
usingPlugin(config: PluginConfig): V4AsynchronousMessageWithPlugin;
|
|
79
81
|
expectsToReceive(description: string, contents: V4AsynchronousMessageBuilderFunc): V4AsynchronousMessageWithContent;
|
|
80
82
|
}
|
package/src/v4/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { V4UnconfiguredGraphQLInteraction } from './graphql/types';
|
|
2
|
+
import type { V4UnconfiguredInteraction } from './http/types';
|
|
3
|
+
import type { V4UnconfiguredAsynchronousMessage, V4UnconfiguredSynchronousMessage } from './message/types';
|
|
4
4
|
export interface V4ConsumerPact {
|
|
5
5
|
addInteraction(): V4UnconfiguredInteraction;
|
|
6
6
|
addSynchronousInteraction(description: string): V4UnconfiguredSynchronousMessage;
|