@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
|
@@ -1,121 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
-
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);
|
|
46
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
-
function step(op) {
|
|
49
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
-
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;
|
|
52
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
-
switch (op[0]) {
|
|
54
|
-
case 0: case 1: t = op; break;
|
|
55
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
-
default:
|
|
59
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
-
if (t[2]) _.ops.pop();
|
|
64
|
-
_.trys.pop(); continue;
|
|
65
|
-
}
|
|
66
|
-
op = body.call(thisArg, _);
|
|
67
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
72
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
73
4
|
};
|
|
74
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
describe('V4 Pact', function () {
|
|
90
|
-
var pact;
|
|
91
|
-
var pactFilePath = path.resolve(process.cwd(), 'pacts', 'v4consumer-v4provider.json');
|
|
92
|
-
var interactionByDescription = function (description) {
|
|
93
|
-
var pactJson = JSON.parse(fs.readFileSync(pactFilePath, 'utf8'));
|
|
94
|
-
var matches = pactJson.interactions.filter(function (item) { return item.description === description; });
|
|
95
|
-
expect(matches, "expected exactly one interaction for \"".concat(description, "\"")).to.have.lengthOf(1);
|
|
96
|
-
var interaction = matches[0];
|
|
6
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
const net = require("node:net");
|
|
9
|
+
const path = require("node:path");
|
|
10
|
+
const v3_1 = require("./v3");
|
|
11
|
+
const v4_1 = require("./v4");
|
|
12
|
+
describe('V4 Pact', () => {
|
|
13
|
+
let pact;
|
|
14
|
+
const pactFilePath = path.resolve(process.cwd(), 'pacts', 'v4consumer-v4provider.json');
|
|
15
|
+
const interactionByDescription = (description) => {
|
|
16
|
+
const pactJson = JSON.parse(fs.readFileSync(pactFilePath, 'utf8'));
|
|
17
|
+
const matches = pactJson.interactions.filter((item) => item.description === description);
|
|
18
|
+
expect(matches, `expected exactly one interaction for "${description}"`).toHaveLength(1);
|
|
19
|
+
const [interaction] = matches;
|
|
97
20
|
return interaction;
|
|
98
21
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
expect(comments.reason).
|
|
102
|
-
expect(comments.text).
|
|
103
|
-
expect(comments.testname).
|
|
22
|
+
const expectCommentsToContain = (interaction, reason, textComment, testName) => {
|
|
23
|
+
const comments = interaction.comments;
|
|
24
|
+
expect(comments.reason).toBe(reason);
|
|
25
|
+
expect(comments.text).toContain(textComment);
|
|
26
|
+
expect(comments.testname).toBe(testName);
|
|
27
|
+
};
|
|
28
|
+
const expectReferenceToEqual = (interaction, group, name, value) => {
|
|
29
|
+
const comments = interaction.comments;
|
|
30
|
+
const references = comments.references;
|
|
31
|
+
expect(references[group][name]).toBe(value);
|
|
104
32
|
};
|
|
105
|
-
beforeEach(
|
|
33
|
+
beforeEach(() => {
|
|
106
34
|
pact = new v4_1.PactV4({
|
|
107
35
|
consumer: 'v4consumer',
|
|
108
36
|
provider: 'v4provider',
|
|
109
37
|
});
|
|
110
38
|
});
|
|
111
|
-
describe('HTTP req/res contract',
|
|
112
|
-
it('generates a pact',
|
|
113
|
-
|
|
39
|
+
describe('HTTP req/res contract', () => {
|
|
40
|
+
it('generates a pact', () => pact
|
|
41
|
+
.addInteraction()
|
|
42
|
+
.given('some state')
|
|
43
|
+
.given('a second state')
|
|
44
|
+
.uponReceiving('a standard HTTP req/res')
|
|
45
|
+
.withRequest('POST', '/', (builder) => {
|
|
46
|
+
builder
|
|
47
|
+
.jsonBody({
|
|
48
|
+
foo: 'bar',
|
|
49
|
+
})
|
|
50
|
+
.headers({
|
|
51
|
+
'x-foo': 'x-bar',
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
.willRespondWith(200, (builder) => {
|
|
55
|
+
builder
|
|
56
|
+
.jsonBody({
|
|
57
|
+
foo: 'bar',
|
|
58
|
+
})
|
|
59
|
+
.headers({
|
|
60
|
+
'x-foo': 'x-bar',
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
.executeTest(async (server) => axios_1.default.post(server.url, {
|
|
64
|
+
foo: 'bar',
|
|
65
|
+
}, {
|
|
66
|
+
headers: {
|
|
67
|
+
'x-foo': 'x-bar',
|
|
68
|
+
},
|
|
69
|
+
})));
|
|
70
|
+
it('generates a pact with interaction metadata', async () => {
|
|
71
|
+
const description = 'v4 metadata http req/res interaction';
|
|
72
|
+
await pact
|
|
114
73
|
.addInteraction()
|
|
115
74
|
.given('some state')
|
|
116
75
|
.given('a second state')
|
|
117
|
-
.uponReceiving(
|
|
118
|
-
.
|
|
76
|
+
.uponReceiving(description)
|
|
77
|
+
.pending()
|
|
78
|
+
.comment({ key: 'reason', value: 'covered by HTTP metadata test' })
|
|
79
|
+
.comment('second note from HTTP metadata test')
|
|
80
|
+
.testName('http metadata test name')
|
|
81
|
+
.withRequest('POST', '/', (builder) => {
|
|
119
82
|
builder
|
|
120
83
|
.jsonBody({
|
|
121
84
|
foo: 'bar',
|
|
@@ -124,7 +87,7 @@ describe('V4 Pact', function () {
|
|
|
124
87
|
'x-foo': 'x-bar',
|
|
125
88
|
});
|
|
126
89
|
})
|
|
127
|
-
.willRespondWith(200,
|
|
90
|
+
.willRespondWith(200, (builder) => {
|
|
128
91
|
builder
|
|
129
92
|
.jsonBody({
|
|
130
93
|
foo: 'bar',
|
|
@@ -133,264 +96,200 @@ describe('V4 Pact', function () {
|
|
|
133
96
|
'x-foo': 'x-bar',
|
|
134
97
|
});
|
|
135
98
|
})
|
|
136
|
-
.executeTest(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}); });
|
|
99
|
+
.executeTest(async (server) => axios_1.default.post(server.url, {
|
|
100
|
+
foo: 'bar',
|
|
101
|
+
}, {
|
|
102
|
+
headers: {
|
|
103
|
+
'x-foo': 'x-bar',
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
106
|
+
const interaction = interactionByDescription(description);
|
|
107
|
+
expect(interaction.pending).toBe(true);
|
|
108
|
+
expectCommentsToContain(interaction, 'covered by HTTP metadata test', 'second note from HTTP metadata test', 'http metadata test name');
|
|
147
109
|
});
|
|
148
|
-
it('
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
switch (_a.label) {
|
|
152
|
-
case 0:
|
|
153
|
-
description = 'v4 metadata http req/res interaction';
|
|
154
|
-
return [4 /*yield*/, pact
|
|
155
|
-
.addInteraction()
|
|
156
|
-
.given('some state')
|
|
157
|
-
.given('a second state')
|
|
158
|
-
.uponReceiving(description)
|
|
159
|
-
.pending()
|
|
160
|
-
.comment({ key: 'reason', value: 'covered by HTTP metadata test' })
|
|
161
|
-
.comment('second note from HTTP metadata test')
|
|
162
|
-
.testName('http metadata test name')
|
|
163
|
-
.withRequest('POST', '/', function (builder) {
|
|
164
|
-
builder
|
|
165
|
-
.jsonBody({
|
|
166
|
-
foo: 'bar',
|
|
167
|
-
})
|
|
168
|
-
.headers({
|
|
169
|
-
'x-foo': 'x-bar',
|
|
170
|
-
});
|
|
171
|
-
})
|
|
172
|
-
.willRespondWith(200, function (builder) {
|
|
173
|
-
builder
|
|
174
|
-
.jsonBody({
|
|
175
|
-
foo: 'bar',
|
|
176
|
-
})
|
|
177
|
-
.headers({
|
|
178
|
-
'x-foo': 'x-bar',
|
|
179
|
-
});
|
|
180
|
-
})
|
|
181
|
-
.executeTest(function (server) { return __awaiter(void 0, void 0, void 0, function () {
|
|
182
|
-
return __generator(this, function (_a) {
|
|
183
|
-
return [2 /*return*/, axios_1.default.post(server.url, {
|
|
184
|
-
foo: 'bar',
|
|
185
|
-
}, {
|
|
186
|
-
headers: {
|
|
187
|
-
'x-foo': 'x-bar',
|
|
188
|
-
},
|
|
189
|
-
})];
|
|
190
|
-
});
|
|
191
|
-
}); })];
|
|
192
|
-
case 1:
|
|
193
|
-
_a.sent();
|
|
194
|
-
interaction = interactionByDescription(description);
|
|
195
|
-
expect(interaction.pending).to.equal(true);
|
|
196
|
-
expectCommentsToContain(interaction, 'covered by HTTP metadata test', 'second note from HTTP metadata test', 'http metadata test name');
|
|
197
|
-
return [2 /*return*/];
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}); });
|
|
201
|
-
it('supports regex matcher for response content-type with optional charset', function () {
|
|
202
|
-
return pact
|
|
110
|
+
it('records interaction references in the pact file', async () => {
|
|
111
|
+
const description = 'v4 http interaction with references';
|
|
112
|
+
await pact
|
|
203
113
|
.addInteraction()
|
|
204
|
-
.uponReceiving(
|
|
114
|
+
.uponReceiving(description)
|
|
115
|
+
.reference('Jira', 'TICKET-123', 'https://jira.example.com/TICKET-123')
|
|
205
116
|
.withRequest('GET', '/')
|
|
206
|
-
.willRespondWith(200
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
117
|
+
.willRespondWith(200)
|
|
118
|
+
.executeTest(async (server) => axios_1.default.get(server.url));
|
|
119
|
+
const interaction = interactionByDescription(description);
|
|
120
|
+
expectReferenceToEqual(interaction, 'Jira', 'TICKET-123', 'https://jira.example.com/TICKET-123');
|
|
121
|
+
});
|
|
122
|
+
it('supports regex matcher for response content-type with optional charset', () => pact
|
|
123
|
+
.addInteraction()
|
|
124
|
+
.uponReceiving('a response with regex content-type header matcher')
|
|
125
|
+
.withRequest('GET', '/')
|
|
126
|
+
.willRespondWith(200, (builder) => {
|
|
127
|
+
builder
|
|
128
|
+
.headers({
|
|
129
|
+
'Content-Type': v3_1.MatchersV3.regex(/^application\/json(;\s?charset=[\w-]+)?$/i, 'application/json'),
|
|
130
|
+
})
|
|
131
|
+
.jsonBody({
|
|
132
|
+
foo: 'bar',
|
|
133
|
+
});
|
|
134
|
+
})
|
|
135
|
+
.executeTest(async (server) => {
|
|
136
|
+
const response = await axios_1.default.get(server.url);
|
|
137
|
+
expect(response.data).toEqual({ foo: 'bar' });
|
|
138
|
+
}));
|
|
139
|
+
it('supports regex matcher for request content-type with optional charset', () => pact
|
|
140
|
+
.addInteraction()
|
|
141
|
+
.uponReceiving('a request with regex content-type header matcher')
|
|
142
|
+
.withRequest('POST', '/', (builder) => {
|
|
143
|
+
builder
|
|
144
|
+
.headers({
|
|
145
|
+
'Content-Type': v3_1.MatchersV3.regex(/^application\/json(;\s?charset=[\w-]+)?$/i, 'application/json'),
|
|
214
146
|
})
|
|
215
|
-
.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
147
|
+
.jsonBody({
|
|
148
|
+
foo: 'bar',
|
|
149
|
+
});
|
|
150
|
+
})
|
|
151
|
+
.willRespondWith(200, (builder) => {
|
|
152
|
+
builder.jsonBody({
|
|
153
|
+
ok: true,
|
|
154
|
+
});
|
|
155
|
+
})
|
|
156
|
+
.executeTest((server) => axios_1.default.post(server.url, {
|
|
157
|
+
foo: 'bar',
|
|
158
|
+
})));
|
|
159
|
+
});
|
|
160
|
+
describe('Asynchronous message contract', () => {
|
|
161
|
+
it('generates a pact with interaction metadata', async () => {
|
|
162
|
+
const description = 'v4 metadata async interaction message';
|
|
163
|
+
await pact
|
|
164
|
+
.addAsynchronousInteraction()
|
|
165
|
+
.given('an async message state')
|
|
166
|
+
.pending()
|
|
167
|
+
.comment({ key: 'reason', value: 'covered by async metadata test' })
|
|
168
|
+
.comment('second note from async metadata test')
|
|
169
|
+
.testName('async metadata test name')
|
|
170
|
+
.expectsToReceive(description, (builder) => {
|
|
171
|
+
builder.withJSONContent({
|
|
172
|
+
event: 'user.created',
|
|
225
173
|
});
|
|
226
|
-
})
|
|
174
|
+
})
|
|
175
|
+
.executeTest(async () => Promise.resolve());
|
|
176
|
+
const interaction = interactionByDescription(description);
|
|
177
|
+
expect(interaction.pending).toBe(true);
|
|
178
|
+
expectCommentsToContain(interaction, 'covered by async metadata test', 'second note from async metadata test', 'async metadata test name');
|
|
227
179
|
});
|
|
228
|
-
it('
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
.
|
|
232
|
-
.
|
|
233
|
-
builder
|
|
234
|
-
|
|
235
|
-
'Content-Type': v3_1.MatchersV3.regex(/^application\/json(;\s?charset=[\w-]+)?$/i, 'application/json'),
|
|
236
|
-
})
|
|
237
|
-
.jsonBody({
|
|
238
|
-
foo: 'bar',
|
|
239
|
-
});
|
|
180
|
+
it('records interaction references in the pact file', async () => {
|
|
181
|
+
const description = 'v4 async interaction with references';
|
|
182
|
+
await pact
|
|
183
|
+
.addAsynchronousInteraction()
|
|
184
|
+
.reference('GitHub', 'PR-456', 'https://github.com/example/repo/pull/456')
|
|
185
|
+
.expectsToReceive(description, (builder) => {
|
|
186
|
+
builder.withJSONContent({ event: 'user.created' });
|
|
240
187
|
})
|
|
241
|
-
.
|
|
242
|
-
|
|
243
|
-
|
|
188
|
+
.executeTest(async () => Promise.resolve());
|
|
189
|
+
const interaction = interactionByDescription(description);
|
|
190
|
+
expectReferenceToEqual(interaction, 'GitHub', 'PR-456', 'https://github.com/example/repo/pull/456');
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
describe('Synchronous message contract', () => {
|
|
194
|
+
it('generates a pact with interaction metadata', async () => {
|
|
195
|
+
const description = 'v4 metadata sync interaction message';
|
|
196
|
+
await pact
|
|
197
|
+
.addSynchronousInteraction(description)
|
|
198
|
+
.given('a synchronous message state')
|
|
199
|
+
.pending()
|
|
200
|
+
.comment({ key: 'reason', value: 'covered by sync metadata test' })
|
|
201
|
+
.comment('second note from sync metadata test')
|
|
202
|
+
.testName('sync metadata test name')
|
|
203
|
+
.withRequest((builder) => {
|
|
204
|
+
builder.withJSONContent({
|
|
205
|
+
request: 'ping',
|
|
244
206
|
});
|
|
245
207
|
})
|
|
246
|
-
.
|
|
247
|
-
|
|
248
|
-
|
|
208
|
+
.withResponse((builder) => {
|
|
209
|
+
builder.withJSONContent({
|
|
210
|
+
response: 'pong',
|
|
249
211
|
});
|
|
250
|
-
})
|
|
212
|
+
})
|
|
213
|
+
.executeTest(async () => Promise.resolve());
|
|
214
|
+
const interaction = interactionByDescription(description);
|
|
215
|
+
expect(interaction.pending).toBe(true);
|
|
216
|
+
expectCommentsToContain(interaction, 'covered by sync metadata test', 'second note from sync metadata test', 'sync metadata test name');
|
|
217
|
+
});
|
|
218
|
+
it('records interaction references in the pact file', async () => {
|
|
219
|
+
const description = 'v4 sync interaction with references';
|
|
220
|
+
await pact
|
|
221
|
+
.addSynchronousInteraction(description)
|
|
222
|
+
.reference('Jira', 'TICKET-789', 'https://jira.example.com/TICKET-789')
|
|
223
|
+
.withRequest((builder) => {
|
|
224
|
+
builder.withJSONContent({ request: 'ping' });
|
|
225
|
+
})
|
|
226
|
+
.withResponse((builder) => {
|
|
227
|
+
builder.withJSONContent({ response: 'pong' });
|
|
228
|
+
})
|
|
229
|
+
.executeTest(async () => Promise.resolve());
|
|
230
|
+
const interaction = interactionByDescription(description);
|
|
231
|
+
expectReferenceToEqual(interaction, 'Jira', 'TICKET-789', 'https://jira.example.com/TICKET-789');
|
|
251
232
|
});
|
|
252
233
|
});
|
|
253
|
-
describe('
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
case 0:
|
|
291
|
-
description = 'v4 metadata sync interaction message';
|
|
292
|
-
return [4 /*yield*/, pact
|
|
293
|
-
.addSynchronousInteraction(description)
|
|
294
|
-
.given('a synchronous message state')
|
|
295
|
-
.pending()
|
|
296
|
-
.comment({ key: 'reason', value: 'covered by sync metadata test' })
|
|
297
|
-
.comment('second note from sync metadata test')
|
|
298
|
-
.testName('sync metadata test name')
|
|
299
|
-
.withRequest(function (builder) {
|
|
300
|
-
builder.withJSONContent({
|
|
301
|
-
request: 'ping',
|
|
302
|
-
});
|
|
303
|
-
})
|
|
304
|
-
.withResponse(function (builder) {
|
|
305
|
-
builder.withJSONContent({
|
|
306
|
-
response: 'pong',
|
|
307
|
-
});
|
|
308
|
-
})
|
|
309
|
-
.executeTest(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
310
|
-
return [2 /*return*/, Promise.resolve()];
|
|
311
|
-
}); }); })];
|
|
312
|
-
case 1:
|
|
313
|
-
_a.sent();
|
|
314
|
-
interaction = interactionByDescription(description);
|
|
315
|
-
expect(interaction.pending).to.equal(true);
|
|
316
|
-
expectCommentsToContain(interaction, 'covered by sync metadata test', 'second note from sync metadata test', 'sync metadata test name');
|
|
317
|
-
return [2 /*return*/];
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}); });
|
|
321
|
-
});
|
|
322
|
-
describe('Plugin test', function () {
|
|
323
|
-
describe('Using the MATT plugin', function () {
|
|
324
|
-
var parseMattMessage = function (raw) {
|
|
325
|
-
return raw.replace(/(MATT)+/g, '').trim();
|
|
326
|
-
};
|
|
327
|
-
var generateMattMessage = function (raw) { return "MATT".concat(raw, "MATT"); };
|
|
328
|
-
describe('HTTP interface', function () {
|
|
329
|
-
it('generates a pact', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
|
-
var mattRequest, mattResponse;
|
|
331
|
-
return __generator(this, function (_a) {
|
|
332
|
-
switch (_a.label) {
|
|
333
|
-
case 0:
|
|
334
|
-
mattRequest = "{\"request\": {\"body\": \"hello\"}}";
|
|
335
|
-
mattResponse = "{\"response\":{\"body\":\"world\"}}";
|
|
336
|
-
return [4 /*yield*/, pact
|
|
337
|
-
.addInteraction()
|
|
338
|
-
.given('the Matt protocol exists')
|
|
339
|
-
.uponReceiving('an HTTP request to /matt')
|
|
340
|
-
.usingPlugin({
|
|
341
|
-
plugin: 'matt',
|
|
342
|
-
version: '0.1.1',
|
|
343
|
-
})
|
|
344
|
-
.withRequest('POST', '/matt', function (builder) {
|
|
345
|
-
builder.pluginContents('application/matt', mattRequest);
|
|
346
|
-
})
|
|
347
|
-
.willRespondWith(200, function (builder) {
|
|
348
|
-
builder.pluginContents('application/matt', mattResponse);
|
|
349
|
-
})
|
|
350
|
-
.executeTest(function (mockserver) {
|
|
351
|
-
return axios_1.default
|
|
352
|
-
.request({
|
|
353
|
-
baseURL: mockserver.url,
|
|
354
|
-
headers: {
|
|
355
|
-
'content-type': 'application/matt',
|
|
356
|
-
Accept: 'application/matt',
|
|
357
|
-
},
|
|
358
|
-
data: generateMattMessage('hello'),
|
|
359
|
-
method: 'POST',
|
|
360
|
-
url: '/matt',
|
|
361
|
-
})
|
|
362
|
-
.then(function (res) {
|
|
363
|
-
expect(parseMattMessage(res.data)).to.eq('world');
|
|
364
|
-
});
|
|
365
|
-
})];
|
|
366
|
-
case 1:
|
|
367
|
-
_a.sent();
|
|
368
|
-
return [2 /*return*/];
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
}); });
|
|
234
|
+
describe('Plugin test', () => {
|
|
235
|
+
describe('Using the MATT plugin', () => {
|
|
236
|
+
const parseMattMessage = (raw) => raw.replace(/(MATT)+/g, '').trim();
|
|
237
|
+
const generateMattMessage = (raw) => `MATT${raw}MATT`;
|
|
238
|
+
describe('HTTP interface', () => {
|
|
239
|
+
it('generates a pact', async () => {
|
|
240
|
+
const mattRequest = `{"request": {"body": "hello"}}`;
|
|
241
|
+
const mattResponse = `{"response":{"body":"world"}}`;
|
|
242
|
+
await pact
|
|
243
|
+
.addInteraction()
|
|
244
|
+
.given('the Matt protocol exists')
|
|
245
|
+
.uponReceiving('an HTTP request to /matt')
|
|
246
|
+
.usingPlugin({
|
|
247
|
+
plugin: 'matt',
|
|
248
|
+
version: '0.1.1',
|
|
249
|
+
})
|
|
250
|
+
.withRequest('POST', '/matt', (builder) => {
|
|
251
|
+
builder.pluginContents('application/matt', mattRequest);
|
|
252
|
+
})
|
|
253
|
+
.willRespondWith(200, (builder) => {
|
|
254
|
+
builder.pluginContents('application/matt', mattResponse);
|
|
255
|
+
})
|
|
256
|
+
.executeTest((mockserver) => axios_1.default
|
|
257
|
+
.request({
|
|
258
|
+
baseURL: mockserver.url,
|
|
259
|
+
headers: {
|
|
260
|
+
'content-type': 'application/matt',
|
|
261
|
+
Accept: 'application/matt',
|
|
262
|
+
},
|
|
263
|
+
data: generateMattMessage('hello'),
|
|
264
|
+
method: 'POST',
|
|
265
|
+
url: '/matt',
|
|
266
|
+
})
|
|
267
|
+
.then((res) => {
|
|
268
|
+
expect(parseMattMessage(res.data)).toBe('world');
|
|
269
|
+
}));
|
|
270
|
+
});
|
|
372
271
|
});
|
|
373
|
-
describe('Synchronous Message (TCP) ',
|
|
374
|
-
describe('with MATT protocol',
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
port
|
|
379
|
-
host
|
|
272
|
+
describe('Synchronous Message (TCP) ', () => {
|
|
273
|
+
describe('with MATT protocol', () => {
|
|
274
|
+
const HOST = '127.0.0.1';
|
|
275
|
+
const sendMattMessageTCP = (message, host, port) => {
|
|
276
|
+
const socket = net.connect({
|
|
277
|
+
port,
|
|
278
|
+
host,
|
|
380
279
|
});
|
|
381
|
-
|
|
280
|
+
const res = socket.write(`${generateMattMessage(message)}\n`);
|
|
382
281
|
if (!res) {
|
|
383
282
|
throw Error('unable to connect to host');
|
|
384
283
|
}
|
|
385
|
-
return new Promise(
|
|
386
|
-
socket.on('data',
|
|
284
|
+
return new Promise((resolve) => {
|
|
285
|
+
socket.on('data', (data) => {
|
|
387
286
|
resolve(parseMattMessage(data.toString()));
|
|
388
287
|
socket.destroy();
|
|
389
288
|
});
|
|
390
289
|
});
|
|
391
290
|
};
|
|
392
|
-
it('generates a pact',
|
|
393
|
-
|
|
291
|
+
it('generates a pact', () => {
|
|
292
|
+
const mattMessage = `{"request": {"body": "hellotcp"}, "response":{"body":"tcpworld"}}`;
|
|
394
293
|
return pact
|
|
395
294
|
.addSynchronousInteraction('a MATT message')
|
|
396
295
|
.usingPlugin({
|
|
@@ -399,18 +298,10 @@ describe('V4 Pact', function () {
|
|
|
399
298
|
})
|
|
400
299
|
.withPluginContents(mattMessage, 'application/matt')
|
|
401
300
|
.startTransport('matt', HOST)
|
|
402
|
-
.executeTest(
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
case 0: return [4 /*yield*/, sendMattMessageTCP('hellotcp', HOST, tc.port)];
|
|
407
|
-
case 1:
|
|
408
|
-
message = _a.sent();
|
|
409
|
-
expect(message).to.eq('tcpworld');
|
|
410
|
-
return [2 /*return*/];
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}); });
|
|
301
|
+
.executeTest(async (tc) => {
|
|
302
|
+
const message = await sendMattMessageTCP('hellotcp', HOST, tc.port);
|
|
303
|
+
expect(message).toBe('tcpworld');
|
|
304
|
+
});
|
|
414
305
|
});
|
|
415
306
|
});
|
|
416
307
|
});
|