@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.
- package/CHANGELOG.md +16 -3
- package/CONTRIBUTING.md +2 -2
- package/README.md +6 -2
- package/package.json +25 -28
- package/src/common/graphQL/configurationError.js +2 -22
- package/src/common/graphQL/configurationError.js.map +1 -1
- package/src/common/graphQL/graphQL.d.ts +2 -2
- package/src/common/graphQL/graphQL.js +11 -14
- package/src/common/graphQL/graphQL.js.map +1 -1
- package/src/common/graphQL/graphQLQueryError.js +2 -22
- package/src/common/graphQL/graphQLQueryError.js.map +1 -1
- package/src/common/logger.js +9 -9
- package/src/common/logger.js.map +1 -1
- package/src/common/matchingRules.d.ts +1 -1
- package/src/common/matchingRules.js +21 -21
- package/src/common/matchingRules.js.map +1 -1
- package/src/common/net.js +36 -42
- package/src/common/net.js.map +1 -1
- package/src/common/net.spec.js +41 -53
- package/src/common/net.spec.js.map +1 -1
- package/src/common/request.js +33 -82
- package/src/common/request.js.map +1 -1
- package/src/common/request.spec.js +26 -26
- package/src/common/request.spec.js.map +1 -1
- package/src/common/spec.js +3 -4
- package/src/common/spec.js.map +1 -1
- package/src/dsl/apolloGraphql.js +7 -25
- package/src/dsl/apolloGraphql.js.map +1 -1
- package/src/dsl/apolloGraphql.spec.js +21 -18
- package/src/dsl/apolloGraphql.spec.js.map +1 -1
- package/src/dsl/graphql.d.ts +2 -2
- package/src/dsl/graphql.js +29 -48
- package/src/dsl/graphql.js.map +1 -1
- package/src/dsl/graphql.spec.js +81 -66
- package/src/dsl/graphql.spec.js.map +1 -1
- package/src/dsl/interaction.d.ts +2 -2
- package/src/dsl/interaction.js +41 -48
- package/src/dsl/interaction.js.map +1 -1
- package/src/dsl/interaction.spec.js +77 -70
- package/src/dsl/interaction.spec.js.map +1 -1
- package/src/dsl/matchers.d.ts +1 -1
- package/src/dsl/matchers.js +19 -31
- package/src/dsl/matchers.js.map +1 -1
- package/src/dsl/matchers.spec.js +199 -208
- package/src/dsl/matchers.spec.js.map +1 -1
- package/src/dsl/message.d.ts +3 -3
- package/src/dsl/options.d.ts +3 -3
- package/src/dsl/verifier/proxy/hooks.d.ts +2 -2
- package/src/dsl/verifier/proxy/hooks.js +42 -112
- package/src/dsl/verifier/proxy/hooks.js.map +1 -1
- package/src/dsl/verifier/proxy/hooks.spec.js +84 -199
- package/src/dsl/verifier/proxy/hooks.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/messages.d.ts +2 -2
- package/src/dsl/verifier/proxy/messages.js +88 -106
- package/src/dsl/verifier/proxy/messages.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.d.ts +1 -1
- package/src/dsl/verifier/proxy/parseBody.js +2 -2
- package/src/dsl/verifier/proxy/parseBody.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.spec.js +31 -76
- package/src/dsl/verifier/proxy/parseBody.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.d.ts +2 -2
- package/src/dsl/verifier/proxy/proxy.js +22 -26
- package/src/dsl/verifier/proxy/proxy.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.spec.js +14 -14
- package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.d.ts +3 -3
- package/src/dsl/verifier/proxy/proxyRequest.js +7 -7
- package/src/dsl/verifier/proxy/proxyRequest.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.spec.js +49 -64
- package/src/dsl/verifier/proxy/proxyRequest.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.d.ts +3 -3
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js +14 -18
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +76 -159
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.d.ts +2 -2
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +23 -72
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +37 -85
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/tracer.d.ts +1 -1
- package/src/dsl/verifier/proxy/tracer.js +42 -35
- package/src/dsl/verifier/proxy/tracer.js.map +1 -1
- package/src/dsl/verifier/proxy/types.d.ts +5 -5
- package/src/dsl/verifier/types.d.ts +3 -3
- package/src/dsl/verifier/verifier.d.ts +1 -1
- package/src/dsl/verifier/verifier.js +49 -56
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/dsl/verifier/verifier.spec.js +76 -93
- package/src/dsl/verifier/verifier.spec.js.map +1 -1
- package/src/errors/configurationError.js +2 -22
- package/src/errors/configurationError.js.map +1 -1
- package/src/errors/graphQLQueryError.js +2 -22
- package/src/errors/graphQLQueryError.js.map +1 -1
- package/src/errors/matcherError.js +2 -22
- package/src/errors/matcherError.js.map +1 -1
- package/src/errors/verificationError.js +2 -22
- package/src/errors/verificationError.js.map +1 -1
- package/src/httpPact/ffi.d.ts +2 -2
- package/src/httpPact/ffi.js +28 -29
- package/src/httpPact/ffi.js.map +1 -1
- package/src/httpPact/ffi.spec.js +30 -31
- package/src/httpPact/ffi.spec.js.map +1 -1
- package/src/httpPact/index.d.ts +3 -3
- package/src/httpPact/index.js +92 -149
- package/src/httpPact/index.js.map +1 -1
- package/src/httpPact/index.spec.js +75 -125
- package/src/httpPact/index.spec.js.map +1 -1
- package/src/httpPact/tracing.js +20 -28
- package/src/httpPact/tracing.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/messageConsumerPact.d.ts +3 -3
- package/src/messageConsumerPact.js +50 -51
- package/src/messageConsumerPact.js.map +1 -1
- package/src/messageConsumerPact.spec.js +50 -49
- package/src/messageConsumerPact.spec.js.map +1 -1
- package/src/messageProviderPact.d.ts +3 -3
- package/src/messageProviderPact.js +68 -85
- package/src/messageProviderPact.js.map +1 -1
- package/src/messageProviderPact.spec.js +75 -66
- package/src/messageProviderPact.spec.js.map +1 -1
- package/src/pact.integration.spec.js +250 -268
- 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.d.ts +2 -2
- package/src/v3/ffi.js +18 -16
- package/src/v3/ffi.js.map +1 -1
- package/src/v3/ffi.spec.d.ts +1 -0
- package/src/v3/ffi.spec.js +50 -0
- package/src/v3/ffi.spec.js.map +1 -0
- package/src/v3/graphql/graphQL.d.ts +4 -4
- package/src/v3/graphql/graphQL.js +50 -75
- package/src/v3/graphql/graphQL.js.map +1 -1
- package/src/v3/matchers.d.ts +2 -2
- package/src/v3/matchers.js +112 -147
- package/src/v3/matchers.js.map +1 -1
- package/src/v3/matchers.spec.js +168 -187
- package/src/v3/matchers.spec.js.map +1 -1
- package/src/v3/pact.d.ts +2 -2
- package/src/v3/pact.js +103 -151
- package/src/v3/pact.js.map +1 -1
- package/src/v3/types.d.ts +1 -1
- package/src/v3/xml/xmlBuilder.d.ts +1 -3
- package/src/v3/xml/xmlBuilder.js +7 -9
- package/src/v3/xml/xmlBuilder.js.map +1 -1
- package/src/v3/xml/xmlElement.d.ts +2 -2
- package/src/v3/xml/xmlElement.js +24 -41
- package/src/v3/xml/xmlElement.js.map +1 -1
- package/src/v3/xml/xmlElement.spec.js +23 -25
- package/src/v3/xml/xmlElement.spec.js.map +1 -1
- package/src/v3/xml/xmlNode.js +2 -5
- package/src/v3/xml/xmlNode.js.map +1 -1
- package/src/v3/xml/xmlText.d.ts +1 -1
- package/src/v3/xml/xmlText.js +9 -25
- package/src/v3/xml/xmlText.js.map +1 -1
- package/src/v4/graphql/graphQLInteractionWithRequest.d.ts +4 -4
- package/src/v4/graphql/graphQLInteractionWithRequest.js +21 -17
- package/src/v4/graphql/graphQLInteractionWithRequest.js.map +1 -1
- package/src/v4/graphql/graphQLRequestBuilder.d.ts +3 -3
- package/src/v4/graphql/graphQLRequestBuilder.js +18 -20
- package/src/v4/graphql/graphQLRequestBuilder.js.map +1 -1
- package/src/v4/graphql/index.d.ts +6 -6
- package/src/v4/graphql/index.js +21 -17
- package/src/v4/graphql/index.js.map +1 -1
- package/src/v4/graphql/types.d.ts +5 -5
- package/src/v4/http/index.d.ts +2 -2
- package/src/v4/http/index.js +48 -93
- package/src/v4/http/index.js.map +1 -1
- package/src/v4/http/interactionWithCompleteRequest.d.ts +4 -7
- package/src/v4/http/interactionWithCompleteRequest.js +6 -10
- package/src/v4/http/interactionWithCompleteRequest.js.map +1 -1
- package/src/v4/http/interactionWithPlugin.d.ts +3 -3
- package/src/v4/http/interactionWithPlugin.js +14 -11
- package/src/v4/http/interactionWithPlugin.js.map +1 -1
- package/src/v4/http/interactionWithPluginRequest.d.ts +2 -2
- package/src/v4/http/interactionWithPluginRequest.js +11 -8
- package/src/v4/http/interactionWithPluginRequest.js.map +1 -1
- package/src/v4/http/interactionWithPluginResponse.d.ts +2 -2
- package/src/v4/http/interactionWithPluginResponse.js +10 -48
- package/src/v4/http/interactionWithPluginResponse.js.map +1 -1
- package/src/v4/http/interactionWithRequest.d.ts +2 -2
- package/src/v4/http/interactionWithRequest.js +11 -8
- package/src/v4/http/interactionWithRequest.js.map +1 -1
- package/src/v4/http/interactionWithResponse.d.ts +2 -2
- package/src/v4/http/interactionWithResponse.js +10 -48
- package/src/v4/http/interactionWithResponse.js.map +1 -1
- package/src/v4/http/requestBuilder.d.ts +3 -3
- package/src/v4/http/requestBuilder.js +32 -34
- package/src/v4/http/requestBuilder.js.map +1 -1
- package/src/v4/http/requestWithPluginBuilder.d.ts +2 -2
- package/src/v4/http/requestWithPluginBuilder.js +26 -46
- package/src/v4/http/requestWithPluginBuilder.js.map +1 -1
- package/src/v4/http/responseBuilder.d.ts +3 -3
- package/src/v4/http/responseBuilder.js +24 -25
- package/src/v4/http/responseBuilder.js.map +1 -1
- package/src/v4/http/responseWithPluginBuilder.d.ts +1 -1
- package/src/v4/http/responseWithPluginBuilder.js +5 -25
- package/src/v4/http/responseWithPluginBuilder.js.map +1 -1
- package/src/v4/http/types.d.ts +3 -2
- package/src/v4/http/unconfiguredInteraction.d.ts +6 -5
- package/src/v4/http/unconfiguredInteraction.js +31 -26
- package/src/v4/http/unconfiguredInteraction.js.map +1 -1
- package/src/v4/index.d.ts +4 -4
- package/src/v4/index.js +31 -35
- package/src/v4/index.js.map +1 -1
- package/src/v4/message/asynchronousMessage.d.ts +7 -6
- package/src/v4/message/asynchronousMessage.js +157 -190
- package/src/v4/message/asynchronousMessage.js.map +1 -1
- package/src/v4/message/index.d.ts +7 -6
- package/src/v4/message/index.js +188 -217
- package/src/v4/message/index.js.map +1 -1
- package/src/v4/message/types.d.ts +5 -3
- package/src/v4/types.d.ts +3 -3
package/src/v4/http/index.js
CHANGED
|
@@ -1,59 +1,24 @@
|
|
|
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
|
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.executeTest = exports.readBinaryData = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
const display_1 = require("../../v3/display");
|
|
9
|
+
const logger_1 = __importDefault(require("../../common/logger"));
|
|
10
|
+
const readBinaryData = (file) => {
|
|
47
11
|
try {
|
|
48
|
-
|
|
12
|
+
const body = fs.readFileSync(file);
|
|
49
13
|
return body;
|
|
50
14
|
}
|
|
51
15
|
catch (e) {
|
|
52
|
-
|
|
16
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
17
|
+
throw new Error(`unable to read file for binary payload : ${error.message}`);
|
|
53
18
|
}
|
|
54
19
|
};
|
|
55
20
|
exports.readBinaryData = readBinaryData;
|
|
56
|
-
|
|
21
|
+
const cleanup = (success, pact, opts, server, cleanupFn) => {
|
|
57
22
|
if (success) {
|
|
58
23
|
pact.writePactFile(opts.dir || './pacts');
|
|
59
24
|
}
|
|
@@ -61,56 +26,46 @@ var cleanup = function (success, pact, opts, server, cleanupFn) {
|
|
|
61
26
|
pact.cleanupPlugins();
|
|
62
27
|
cleanupFn();
|
|
63
28
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
cleanup(false, pact, opts, server, cleanupFn);
|
|
93
|
-
// If the tests throws an error, we need to rethrow the error, but print out
|
|
94
|
-
// any additional mock server errors to help the user understand what happened
|
|
95
|
-
// (The proximate cause here is often the HTTP 500 from the mock server,
|
|
96
|
-
// where the HTTP client then throws)
|
|
97
|
-
if (error) {
|
|
98
|
-
logger_1.default.error(errorMessage);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
// Test didn't throw, so we need to ensure the test fails
|
|
102
|
-
return [2 /*return*/, Promise.reject(new Error(errorMessage))];
|
|
103
|
-
}
|
|
104
|
-
// Scenario: test threw an error, but Pact validation was OK (error in client or test)
|
|
105
|
-
if (error) {
|
|
106
|
-
cleanup(false, pact, opts, server, cleanupFn);
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
110
|
-
cleanup(true, pact, opts, server, cleanupFn);
|
|
111
|
-
return [2 /*return*/, val];
|
|
29
|
+
const executeTest = async (pact, opts, testFn, cleanupFn) => {
|
|
30
|
+
const scheme = opts.tls ? 'https' : 'http';
|
|
31
|
+
const host = opts.host || '127.0.0.1';
|
|
32
|
+
const port = pact.createMockServer(host, opts.port || 0, false);
|
|
33
|
+
const server = { port, url: `${scheme}://${host}:${port}`, id: 'unknown' };
|
|
34
|
+
let val;
|
|
35
|
+
let error;
|
|
36
|
+
try {
|
|
37
|
+
val = await testFn(server);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
error = e instanceof Error ? e : new Error(String(e));
|
|
41
|
+
}
|
|
42
|
+
const matchingResults = pact.mockServerMismatches(port);
|
|
43
|
+
const errors = (0, display_1.filterMissingFeatureFlag)(matchingResults);
|
|
44
|
+
const success = pact.mockServerMatchedSuccessfully(port);
|
|
45
|
+
// Scenario: Pact validation failed
|
|
46
|
+
if (!success && errors.length > 0) {
|
|
47
|
+
let errorMessage = 'Test failed for the following reasons:';
|
|
48
|
+
errorMessage += `\n\n ${(0, display_1.generateMockServerError)(matchingResults, '\t')}`;
|
|
49
|
+
cleanup(false, pact, opts, server, cleanupFn);
|
|
50
|
+
// If the tests throws an error, we need to rethrow the error, but print out
|
|
51
|
+
// any additional mock server errors to help the user understand what happened
|
|
52
|
+
// (The proximate cause here is often the HTTP 500 from the mock server,
|
|
53
|
+
// where the HTTP client then throws)
|
|
54
|
+
if (error) {
|
|
55
|
+
logger_1.default.error(errorMessage);
|
|
56
|
+
throw error;
|
|
112
57
|
}
|
|
113
|
-
|
|
114
|
-
|
|
58
|
+
// Test didn't throw, so we need to ensure the test fails
|
|
59
|
+
return Promise.reject(new Error(errorMessage));
|
|
60
|
+
}
|
|
61
|
+
// Scenario: test threw an error, but Pact validation was OK (error in client or test)
|
|
62
|
+
if (error) {
|
|
63
|
+
cleanup(false, pact, opts, server, cleanupFn);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
// Scenario: Pact validation passed, test didn't throw - return the callback value
|
|
67
|
+
cleanup(true, pact, opts, server, cleanupFn);
|
|
68
|
+
return val;
|
|
69
|
+
};
|
|
115
70
|
exports.executeTest = executeTest;
|
|
116
71
|
//# sourceMappingURL=index.js.map
|
package/src/v4/http/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/http/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/http/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4InteractionWithCompleteRequest, PactV4Options, V4Response, V4InteractionWithResponse } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4InteractionWithCompleteRequest, PactV4Options, V4Response, V4InteractionWithResponse } from './types';
|
|
3
3
|
export declare class InteractionWithCompleteRequest implements V4InteractionWithCompleteRequest {
|
|
4
|
-
private pact;
|
|
5
|
-
private interaction;
|
|
6
|
-
private opts;
|
|
7
4
|
protected cleanupFn: () => void;
|
|
8
|
-
constructor(
|
|
9
|
-
withCompleteResponse(
|
|
5
|
+
constructor(_pact: ConsumerPact, _interaction: ConsumerInteraction, _opts: PactV4Options, cleanupFn: () => void);
|
|
6
|
+
withCompleteResponse(_response: V4Response): V4InteractionWithResponse;
|
|
10
7
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionWithCompleteRequest = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.interaction = interaction;
|
|
8
|
-
this.opts = opts;
|
|
4
|
+
class InteractionWithCompleteRequest {
|
|
5
|
+
cleanupFn;
|
|
6
|
+
constructor(_pact, _interaction, _opts, cleanupFn) {
|
|
9
7
|
this.cleanupFn = cleanupFn;
|
|
10
8
|
throw Error('V4InteractionWithCompleteRequest is unimplemented');
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
InteractionWithCompleteRequest.prototype.withCompleteResponse = function (response) {
|
|
10
|
+
withCompleteResponse(_response) {
|
|
14
11
|
throw new Error('withCompleteResponse is not implemented');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}());
|
|
12
|
+
}
|
|
13
|
+
}
|
|
18
14
|
exports.InteractionWithCompleteRequest = InteractionWithCompleteRequest;
|
|
19
15
|
//# sourceMappingURL=interactionWithCompleteRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithCompleteRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithCompleteRequest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interactionWithCompleteRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithCompleteRequest.ts"],"names":[],"mappings":";;;AAWA,MAAa,8BAA8B;IAO7B;IAJZ,YACE,KAAmB,EACnB,YAAiC,EACjC,KAAoB,EACV,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QAE/B,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,oBAAoB,CAAC,SAAqB;QACxC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;CACF;AAfD,wEAeC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { Path } from '../../v3';
|
|
3
|
-
import { V4InteractionWithPlugin, PactV4Options, PluginConfig, V4PluginRequestBuilderFunc, V4InteractionWithPluginRequest } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { Path } from '../../v3';
|
|
3
|
+
import type { V4InteractionWithPlugin, PactV4Options, PluginConfig, V4PluginRequestBuilderFunc, V4InteractionWithPluginRequest } from './types';
|
|
4
4
|
export declare class InteractionWithPlugin implements V4InteractionWithPlugin {
|
|
5
5
|
private pact;
|
|
6
6
|
private interaction;
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionWithPlugin = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const requestWithPluginBuilder_1 = require("./requestWithPluginBuilder");
|
|
5
|
+
const interactionWithPluginRequest_1 = require("./interactionWithPluginRequest");
|
|
6
|
+
const matchers_1 = require("../../v3/matchers");
|
|
7
|
+
class InteractionWithPlugin {
|
|
8
|
+
pact;
|
|
9
|
+
interaction;
|
|
10
|
+
opts;
|
|
11
|
+
cleanupFn;
|
|
8
12
|
// tslint:disable:no-empty-function
|
|
9
|
-
|
|
13
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
10
14
|
this.pact = pact;
|
|
11
15
|
this.interaction = interaction;
|
|
12
16
|
this.opts = opts;
|
|
13
17
|
this.cleanupFn = cleanupFn;
|
|
14
18
|
}
|
|
15
19
|
// Multiple plugins are allowed
|
|
16
|
-
|
|
20
|
+
usingPlugin(config) {
|
|
17
21
|
this.pact.addPlugin(config.plugin, config.version);
|
|
18
22
|
return this;
|
|
19
|
-
}
|
|
20
|
-
|
|
23
|
+
}
|
|
24
|
+
withRequest(method, path, builder) {
|
|
21
25
|
this.interaction.withRequest(method, (0, matchers_1.matcherValueOrString)(path));
|
|
22
26
|
if (typeof builder === 'function') {
|
|
23
27
|
builder(new requestWithPluginBuilder_1.RequestWithPluginBuilder(this.interaction));
|
|
24
28
|
}
|
|
25
29
|
return new interactionWithPluginRequest_1.InteractionWithPluginRequest(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
29
32
|
exports.InteractionWithPlugin = InteractionWithPlugin;
|
|
30
33
|
//# sourceMappingURL=interactionWithPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithPlugin.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPlugin.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interactionWithPlugin.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPlugin.ts"],"names":[],"mappings":";;;AAIA,yEAAsE;AACtE,iFAA8E;AAE9E,gDAAyD;AASzD,MAAa,qBAAqB;IAGtB;IACA;IACA;IACE;IALZ,mCAAmC;IACnC,YACU,IAAkB,EAClB,WAAgC,EAChC,IAAmB,EACjB,SAAqB;QAHvB,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAe;QACjB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,+BAA+B;IAC/B,WAAW,CAAC,MAAoB;QAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CACT,MAAc,EACd,IAAU,EACV,OAAoC;QAEpC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE,IAAA,+BAAoB,EAAC,IAAI,CAAC,CAAC,CAAC;QAEjE,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,mDAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,2DAA4B,CACrC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,SAAS,CACf,CAAC;IACJ,CAAC;CACF;AAjCD,sDAiCC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4InteractionWithPluginRequest, PactV4Options, V4PluginResponseBuilderFunc, V4InteractionWithPluginResponse } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4InteractionWithPluginRequest, PactV4Options, V4PluginResponseBuilderFunc, V4InteractionWithPluginResponse } from './types';
|
|
3
3
|
export declare class InteractionWithPluginRequest implements V4InteractionWithPluginRequest {
|
|
4
4
|
private pact;
|
|
5
5
|
private interaction;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionWithPluginRequest = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const interactionWithPluginResponse_1 = require("./interactionWithPluginResponse");
|
|
5
|
+
const responseWithPluginBuilder_1 = require("./responseWithPluginBuilder");
|
|
6
|
+
class InteractionWithPluginRequest {
|
|
7
|
+
pact;
|
|
8
|
+
interaction;
|
|
9
|
+
opts;
|
|
10
|
+
cleanupFn;
|
|
7
11
|
// tslint:disable:no-empty-function
|
|
8
|
-
|
|
12
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
9
13
|
this.pact = pact;
|
|
10
14
|
this.interaction = interaction;
|
|
11
15
|
this.opts = opts;
|
|
12
16
|
this.cleanupFn = cleanupFn;
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
willRespondWith(status, builder) {
|
|
15
19
|
this.interaction.withStatus(status);
|
|
16
20
|
if (typeof builder === 'function') {
|
|
17
21
|
builder(new responseWithPluginBuilder_1.ResponseWithPluginBuilder(this.interaction));
|
|
18
22
|
}
|
|
19
23
|
return new interactionWithPluginResponse_1.InteractionWithPluginResponse(this.pact, this.opts, this.cleanupFn);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
23
26
|
exports.InteractionWithPluginRequest = InteractionWithPluginRequest;
|
|
24
27
|
//# sourceMappingURL=interactionWithPluginRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithPluginRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPluginRequest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interactionWithPluginRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPluginRequest.ts"],"names":[],"mappings":";;;AAIA,mFAAgF;AAChF,2EAAwE;AAQxE,MAAa,4BAA4B;IAK7B;IACA;IACA;IACE;IALZ,mCAAmC;IACnC,YACU,IAAkB,EAClB,WAAgC,EAChC,IAAmB,EACjB,SAAqB;QAHvB,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAe;QACjB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,eAAe,CACb,MAAc,EACd,OAAqC;QAErC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,qDAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,6DAA6B,CACtC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,SAAS,CACf,CAAC;IACJ,CAAC;CACF;AA3BD,oEA2BC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4InteractionWithPluginResponse, PactV4Options, V4MockServer } from './types';
|
|
1
|
+
import type { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4InteractionWithPluginResponse, PactV4Options, V4MockServer } from './types';
|
|
3
3
|
export declare class InteractionWithPluginResponse implements V4InteractionWithPluginResponse {
|
|
4
4
|
private pact;
|
|
5
5
|
private opts;
|
|
@@ -1,58 +1,20 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.InteractionWithPluginResponse = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class InteractionWithPluginResponse {
|
|
6
|
+
pact;
|
|
7
|
+
opts;
|
|
8
|
+
cleanupFn;
|
|
42
9
|
// tslint:disable:no-empty-function
|
|
43
|
-
|
|
10
|
+
constructor(pact, opts, cleanupFn) {
|
|
44
11
|
this.pact = pact;
|
|
45
12
|
this.opts = opts;
|
|
46
13
|
this.cleanupFn = cleanupFn;
|
|
47
14
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
return InteractionWithPluginResponse;
|
|
56
|
-
}());
|
|
15
|
+
async executeTest(testFn) {
|
|
16
|
+
return (0, _1.executeTest)(this.pact, this.opts, testFn, this.cleanupFn);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
57
19
|
exports.InteractionWithPluginResponse = InteractionWithPluginResponse;
|
|
58
20
|
//# sourceMappingURL=interactionWithPluginResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithPluginResponse.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPluginResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactionWithPluginResponse.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithPluginResponse.ts"],"names":[],"mappings":";;;AACA,wBAAgC;AAOhC,MAAa,6BAA6B;IAK9B;IACA;IACE;IAJZ,mCAAmC;IACnC,YACU,IAAkB,EAClB,IAAmB,EACjB,SAAqB;QAFvB,SAAI,GAAJ,IAAI,CAAc;QAClB,SAAI,GAAJ,IAAI,CAAe;QACjB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,KAAK,CAAC,WAAW,CACf,MAAgD;QAEhD,OAAO,IAAA,cAAW,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACnE,CAAC;CACF;AAfD,sEAeC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4InteractionWithRequest, PactV4Options, V4ResponseBuilderFunc, V4InteractionWithResponse } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4InteractionWithRequest, PactV4Options, V4ResponseBuilderFunc, V4InteractionWithResponse } from './types';
|
|
3
3
|
export declare class InteractionWithRequest implements V4InteractionWithRequest {
|
|
4
4
|
private pact;
|
|
5
5
|
private interaction;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionWithRequest = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const interactionWithResponse_1 = require("./interactionWithResponse");
|
|
5
|
+
const responseBuilder_1 = require("./responseBuilder");
|
|
6
|
+
class InteractionWithRequest {
|
|
7
|
+
pact;
|
|
8
|
+
interaction;
|
|
9
|
+
opts;
|
|
10
|
+
cleanupFn;
|
|
7
11
|
// tslint:disable:no-empty-function
|
|
8
|
-
|
|
12
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
9
13
|
this.pact = pact;
|
|
10
14
|
this.interaction = interaction;
|
|
11
15
|
this.opts = opts;
|
|
12
16
|
this.cleanupFn = cleanupFn;
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
willRespondWith(status, builder) {
|
|
15
19
|
this.interaction.withStatus(status);
|
|
16
20
|
if (typeof builder === 'function') {
|
|
17
21
|
builder(new responseBuilder_1.ResponseBuilder(this.interaction));
|
|
18
22
|
}
|
|
19
23
|
return new interactionWithResponse_1.InteractionWithResponse(this.pact, this.opts, this.cleanupFn);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
23
26
|
exports.InteractionWithRequest = InteractionWithRequest;
|
|
24
27
|
//# sourceMappingURL=interactionWithRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithRequest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interactionWithRequest.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithRequest.ts"],"names":[],"mappings":";;;AAIA,uEAAoE;AACpE,uDAAoD;AAQpD,MAAa,sBAAsB;IAGvB;IACA;IACA;IACE;IALZ,mCAAmC;IACnC,YACU,IAAkB,EAClB,WAAgC,EAChC,IAAmB,EACjB,SAAqB;QAHvB,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAe;QACjB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,eAAe,CACb,MAAc,EACd,OAA+B;QAE/B,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,iCAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,IAAI,iDAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC;CACF;AArBD,wDAqBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4InteractionWithResponse, PactV4Options, TestFunction } from './types';
|
|
1
|
+
import type { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4InteractionWithResponse, PactV4Options, TestFunction } from './types';
|
|
3
3
|
export declare class InteractionWithResponse implements V4InteractionWithResponse {
|
|
4
4
|
private pact;
|
|
5
5
|
private opts;
|
|
@@ -1,58 +1,20 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.InteractionWithResponse = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class InteractionWithResponse {
|
|
6
|
+
pact;
|
|
7
|
+
opts;
|
|
8
|
+
cleanupFn;
|
|
42
9
|
// tslint:disable:no-empty-function
|
|
43
|
-
|
|
10
|
+
constructor(pact, opts, cleanupFn) {
|
|
44
11
|
this.pact = pact;
|
|
45
12
|
this.opts = opts;
|
|
46
13
|
this.cleanupFn = cleanupFn;
|
|
47
14
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
return InteractionWithResponse;
|
|
56
|
-
}());
|
|
15
|
+
async executeTest(testFn) {
|
|
16
|
+
return (0, _1.executeTest)(this.pact, this.opts, testFn, this.cleanupFn);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
57
19
|
exports.InteractionWithResponse = InteractionWithResponse;
|
|
58
20
|
//# sourceMappingURL=interactionWithResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionWithResponse.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactionWithResponse.js","sourceRoot":"","sources":["../../../../src/v4/http/interactionWithResponse.ts"],"names":[],"mappings":";;;AACA,wBAAgC;AAOhC,MAAa,uBAAuB;IAGxB;IACA;IACE;IAJZ,mCAAmC;IACnC,YACU,IAAkB,EAClB,IAAmB,EACjB,SAAqB;QAFvB,SAAI,GAAJ,IAAI,CAAc;QAClB,SAAI,GAAJ,IAAI,CAAe;QACjB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAI,MAAuB;QAC1C,OAAO,IAAA,cAAW,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACnE,CAAC;CACF;AAXD,0DAWC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { TemplateQuery, TemplateHeaders, Rules } from '../../v3';
|
|
3
|
-
import { V4RequestBuilder } from './types';
|
|
1
|
+
import type { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { TemplateQuery, TemplateHeaders, Rules } from '../../v3';
|
|
3
|
+
import type { V4RequestBuilder } from './types';
|
|
4
4
|
export declare class RequestBuilder implements V4RequestBuilder {
|
|
5
5
|
protected interaction: ConsumerInteraction;
|
|
6
6
|
constructor(interaction: ConsumerInteraction);
|