@enricai/barnacle 1.0.0 → 1.1.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/README.md +51 -0
- package/dist/config.d.ts +10 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/lib/datadog.d.ts +20 -5
- package/dist/lib/datadog.d.ts.map +1 -1
- package/dist/lib/datadog.js +65 -19
- package/dist/lib/datadog.js.map +1 -1
- package/dist/lib/errors.d.ts +8 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +11 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/logging.js +1 -1
- package/dist/lib/logging.js.map +1 -1
- package/dist/lib/statsd.d.ts +20 -5
- package/dist/lib/statsd.d.ts.map +1 -1
- package/dist/lib/statsd.js +56 -28
- package/dist/lib/statsd.js.map +1 -1
- package/dist/scraper/http-client.js +2 -2
- package/dist/scraper/http-client.js.map +1 -1
- package/dist/scraper/raw-fetch.d.ts +22 -0
- package/dist/scraper/raw-fetch.d.ts.map +1 -1
- package/dist/scraper/raw-fetch.js +2 -2
- package/dist/scraper/raw-fetch.js.map +1 -1
- package/dist/scraper/session-browserbase.d.ts +4 -4
- package/dist/scraper/session-browserbase.js +4 -4
- package/dist/scripts/recon-generate.d.ts.map +1 -1
- package/dist/scripts/recon-generate.js +42 -14
- package/dist/scripts/recon-generate.js.map +1 -1
- package/dist/testing/{contract-parity-suite.d.ts → contract-parity-suite.d.mts} +2 -2
- package/dist/testing/contract-parity-suite.d.mts.map +1 -0
- package/dist/testing/{contract-parity-suite.js → contract-parity-suite.mjs} +9 -12
- package/dist/testing/contract-parity-suite.mjs.map +1 -0
- package/dist/testing/{coverage-guard-suite.d.ts → coverage-guard-suite.d.mts} +1 -1
- package/dist/testing/coverage-guard-suite.d.mts.map +1 -0
- package/dist/testing/{coverage-guard-suite.js → coverage-guard-suite.mjs} +9 -12
- package/dist/testing/coverage-guard-suite.mjs.map +1 -0
- package/dist/testing/persona-fixture.d.ts +8 -6
- package/dist/testing/persona-fixture.d.ts.map +1 -1
- package/dist/testing/persona-fixture.js +8 -6
- package/dist/testing/persona-fixture.js.map +1 -1
- package/dist/testing/{replay-integration-suite.d.ts → replay-integration-suite.d.mts} +3 -3
- package/dist/testing/replay-integration-suite.d.mts.map +1 -0
- package/dist/testing/{replay-integration-suite.js → replay-integration-suite.mjs} +11 -14
- package/dist/testing/replay-integration-suite.mjs.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +40 -20
- package/dist/lib/application-answers.d.ts +0 -151
- package/dist/lib/application-answers.d.ts.map +0 -1
- package/dist/lib/application-answers.js +0 -95
- package/dist/lib/application-answers.js.map +0 -1
- package/dist/scripts/hca-inbox-poll.d.ts +0 -19
- package/dist/scripts/hca-inbox-poll.d.ts.map +0 -1
- package/dist/scripts/hca-inbox-poll.js +0 -151
- package/dist/scripts/hca-inbox-poll.js.map +0 -1
- package/dist/testing/answers-fixture.d.ts +0 -13
- package/dist/testing/answers-fixture.d.ts.map +0 -1
- package/dist/testing/answers-fixture.js +0 -37
- package/dist/testing/answers-fixture.js.map +0 -1
- package/dist/testing/contract-parity-suite.d.ts.map +0 -1
- package/dist/testing/contract-parity-suite.js.map +0 -1
- package/dist/testing/coverage-guard-suite.d.ts.map +0 -1
- package/dist/testing/coverage-guard-suite.js.map +0 -1
- package/dist/testing/replay-integration-suite.d.ts.map +0 -1
- package/dist/testing/replay-integration-suite.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Eliminates the duplicated offline schema-parity scaffold that every contract
|
|
4
3
|
* parity test repeats: build canonical payload → assert safeParse succeeds →
|
|
@@ -6,34 +5,32 @@
|
|
|
6
5
|
* issue on the expected path. Mirrors the shape of defineReplayIntegrationSuite
|
|
7
6
|
* so adding a parity guard for a new site is a one-call drop-in.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
exports.defineContractParitySuite = defineContractParitySuite;
|
|
11
|
-
const vitest_1 = require("vitest");
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
12
9
|
/**
|
|
13
10
|
* Defines an offline schema-parity suite. Runs unconditionally — no
|
|
14
11
|
* INTEGRATION environment variable needed. The suite has one accept case and
|
|
15
12
|
* one `it` per rejection case.
|
|
16
13
|
*/
|
|
17
|
-
function defineContractParitySuite(opts) {
|
|
14
|
+
export function defineContractParitySuite(opts) {
|
|
18
15
|
const { suiteName, plugin, buildPayload, rejectionCases } = opts;
|
|
19
16
|
const schema = plugin.meta.bodySchema;
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
describe(suiteName, () => {
|
|
18
|
+
it("accepts the canonical payload", () => {
|
|
22
19
|
const result = schema.safeParse(buildPayload());
|
|
23
|
-
|
|
20
|
+
expect(result.success, result.success ? "" : JSON.stringify(result.error)).toBe(true);
|
|
24
21
|
});
|
|
25
22
|
for (const rc of rejectionCases) {
|
|
26
|
-
|
|
23
|
+
it(`rejects: ${rc.name}`, () => {
|
|
27
24
|
const mutated = rc.mutate({ ...buildPayload() });
|
|
28
25
|
const result = schema.safeParse(mutated);
|
|
29
|
-
|
|
26
|
+
expect(result.success).toBe(false);
|
|
30
27
|
if (!result.success && rc.expectIssuePath !== undefined) {
|
|
31
28
|
const path = rc.expectIssuePath;
|
|
32
29
|
const hit = result.error.issues.find((issue) => path.every((segment) => issue.path.includes(segment)));
|
|
33
|
-
|
|
30
|
+
expect(hit, `expected an issue whose path includes ${JSON.stringify(path)}, got: ${JSON.stringify(result.error.issues.map((i) => i.path))}`).toBeDefined();
|
|
34
31
|
}
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
|
-
//# sourceMappingURL=contract-parity-suite.
|
|
36
|
+
//# sourceMappingURL=contract-parity-suite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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oBAChC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7C,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACtD,CAAC;oBACF,MAAM,CACJ,GAAG,EACH,yCAAyC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAChI,CAAC,WAAW,EAAE,CAAC;gBAClB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -43,4 +43,4 @@ export interface CoverageGuardSuiteOptions {
|
|
|
43
43
|
* baking site-specific logic into the engine helper.
|
|
44
44
|
*/
|
|
45
45
|
export declare function defineCoverageGuardSuite(opts: CoverageGuardSuiteOptions): void;
|
|
46
|
-
//# sourceMappingURL=coverage-guard-suite.d.
|
|
46
|
+
//# sourceMappingURL=coverage-guard-suite.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-guard-suite.d.mts","sourceRoot":"","sources":["../../src/testing/coverage-guard-suite.mts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,iFAAiF;AACjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACxC,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAoB9E"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Provides a registry-driven structural coverage guard for site plugins.
|
|
4
3
|
* Mirrors the registry-first design of the loader: iterates SITE_PLUGINS (or a
|
|
@@ -7,11 +6,9 @@
|
|
|
7
6
|
* where SITE_PLUGINS ships empty (0 iterations → trivially green); branches that
|
|
8
7
|
* populate the registry gain coverage automatically.
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const node_path_1 = require("node:path");
|
|
14
|
-
const vitest_1 = require("vitest");
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { resolve } from "node:path";
|
|
11
|
+
import { describe, expect, it } from "vitest";
|
|
15
12
|
/**
|
|
16
13
|
* Defines a registry-driven structural coverage guard. For each plugin in
|
|
17
14
|
* `opts.plugins`, registers an `it` that asserts
|
|
@@ -21,19 +18,19 @@ const vitest_1 = require("vitest");
|
|
|
21
18
|
* `it` blocks (e.g. integration test file or replay fixture presence) without
|
|
22
19
|
* baking site-specific logic into the engine helper.
|
|
23
20
|
*/
|
|
24
|
-
function defineCoverageGuardSuite(opts) {
|
|
21
|
+
export function defineCoverageGuardSuite(opts) {
|
|
25
22
|
const { suiteName, plugins, sitesDir, extraAssertions } = opts;
|
|
26
23
|
if (plugins.length === 0)
|
|
27
24
|
return;
|
|
28
|
-
|
|
25
|
+
describe(suiteName, () => {
|
|
29
26
|
for (const plugin of plugins) {
|
|
30
27
|
const { siteId } = plugin.meta;
|
|
31
|
-
const pluginDir =
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const pluginDir = resolve(sitesDir, siteId);
|
|
29
|
+
it(`${siteId}: contract.parity.test.ts exists`, () => {
|
|
30
|
+
expect(existsSync(resolve(pluginDir, "contract.parity.test.ts")), `${siteId}/contract.parity.test.ts must exist`).toBe(true);
|
|
34
31
|
});
|
|
35
32
|
extraAssertions?.(pluginDir, siteId);
|
|
36
33
|
}
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
|
-
//# sourceMappingURL=coverage-guard-suite.
|
|
36
|
+
//# sourceMappingURL=coverage-guard-suite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-guard-suite.mjs","sourceRoot":"","sources":["../../src/testing/coverage-guard-suite.mts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AA6B9C;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAA+B;IACtE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAE/D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEjC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;YAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAE5C,EAAE,CAAC,GAAG,MAAM,kCAAkC,EAAE,GAAG,EAAE;gBACnD,MAAM,CACJ,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC,EACzD,GAAG,MAAM,qCAAqC,CAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;YAEH,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -13,14 +13,16 @@ export declare const TEST_PERSONA: {
|
|
|
13
13
|
readonly FirstName: "Reginald";
|
|
14
14
|
readonly LastName: "Reconaldo";
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* 555-0100..555-0199 is the only NANP range reserved for fiction, so this
|
|
17
|
+
* number reaches no real person — unlike a plausible-looking area-code/NXX
|
|
18
|
+
* pair, which is assignable and would send test traffic to a stranger.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Avoid famously-fictional numbers like 310-867-5309 ("Jenny" pop-song):
|
|
21
|
+
* some ATS phone widgets reject those with "Please provide correct phone
|
|
22
|
+
* number." If a widget rejects this 555-01XX form too, prefer a number the
|
|
23
|
+
* project controls over reverting to a real one.
|
|
22
24
|
*/
|
|
23
|
-
readonly Phone: "+1 208-
|
|
25
|
+
readonly Phone: "+1 208-555-0142";
|
|
24
26
|
readonly Address: {
|
|
25
27
|
readonly Line1: "123 Test Lane";
|
|
26
28
|
readonly City: "Austin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persona-fixture.d.ts","sourceRoot":"","sources":["../../src/testing/persona-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY;;;IAGvB
|
|
1
|
+
{"version":3,"file":"persona-fixture.d.ts","sourceRoot":"","sources":["../../src/testing/persona-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY;;;IAGvB;;;;;;;;;OASG;;;;;QAKD,gEAAgE;;QAEhE,6EAA6E;;;QAG7E;gEACwD;;QAExD,yDAAyD;;QAEzD,iDAAiD;;;IAGnD;;;;OAIG;;;IAGH,gFAAgF;;;;;;;;;IAUhF,qFAAqF;;;;;;;;;;;;;;;;;IAqBrF,yDAAyD;;CAEjD,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC"}
|
|
@@ -16,14 +16,16 @@ exports.TEST_PERSONA = {
|
|
|
16
16
|
FirstName: "Reginald",
|
|
17
17
|
LastName: "Reconaldo",
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* 555-0100..555-0199 is the only NANP range reserved for fiction, so this
|
|
20
|
+
* number reaches no real person — unlike a plausible-looking area-code/NXX
|
|
21
|
+
* pair, which is assignable and would send test traffic to a stranger.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Avoid famously-fictional numbers like 310-867-5309 ("Jenny" pop-song):
|
|
24
|
+
* some ATS phone widgets reject those with "Please provide correct phone
|
|
25
|
+
* number." If a widget rejects this 555-01XX form too, prefer a number the
|
|
26
|
+
* project controls over reverting to a real one.
|
|
25
27
|
*/
|
|
26
|
-
Phone: "+1 208-
|
|
28
|
+
Phone: "+1 208-555-0142",
|
|
27
29
|
Address: {
|
|
28
30
|
Line1: "123 Test Lane",
|
|
29
31
|
City: "Austin",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persona-fixture.js","sourceRoot":"","sources":["../../src/testing/persona-fixture.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAG;IAC1B,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,WAAW;IACrB
|
|
1
|
+
{"version":3,"file":"persona-fixture.js","sourceRoot":"","sources":["../../src/testing/persona-fixture.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAG;IAC1B,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,WAAW;IACrB;;;;;;;;;OASG;IACH,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE;QACP,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,QAAQ;QACd,gEAAgE;QAChE,iBAAiB,EAAE,IAAI;QACvB,6EAA6E;QAC7E,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,OAAO;QACnB;gEACwD;QACxD,MAAM,EAAE,eAAe;QACvB,yDAAyD;QACzD,WAAW,EAAE,eAAe;QAC5B,iDAAiD;QACjD,WAAW,EAAE,IAAI;KAClB;IACD;;;;OAIG;IACH,GAAG,EAAE,aAAa;IAClB,WAAW,EAAE,YAAY;IACzB,gFAAgF;IAChF,UAAU,EAAE;QACV,KAAK,EAAE,+BAA+B;QACtC,WAAW,EAAE,eAAe;QAC5B,YAAY,EAAE,iBAAiB;QAC/B,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,YAAY;QACrB,mBAAmB,EACjB,8FAA8F;KACjG;IACD,qFAAqF;IACrF,UAAU,EAAE;QACV;YACE,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,2BAA2B;YAClC,KAAK,EAAE,iBAAiB;SACzB;QACD;YACE,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,+BAA+B;YACtC,KAAK,EAAE,iBAAiB;SACzB;QACD;YACE,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,8BAA8B;YACrC,KAAK,EAAE,iBAAiB;SACzB;KACF;IACD,yDAAyD;IACzD,aAAa,EAAE,oBAAoB;CAC3B,CAAC"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* the generic scaffold (file load, INTEGRATION gate, fan-out, default assertion)
|
|
6
6
|
* lives here once.
|
|
7
7
|
*/
|
|
8
|
-
import type { SitePlugin } from "../site-plugin";
|
|
9
|
-
import type { PollTestmailInboxOptions, TestmailInbox, TestmailMessage } from "../testmail/client";
|
|
8
|
+
import type { SitePlugin } from "../site-plugin.js";
|
|
9
|
+
import type { PollTestmailInboxOptions, TestmailInbox, TestmailMessage } from "../testmail/client.js";
|
|
10
10
|
/** Job source: either a pre-loaded array or a path resolved relative to the caller's directory. */
|
|
11
11
|
type JobsSource<TJob> = {
|
|
12
12
|
jobs: TJob[];
|
|
@@ -47,4 +47,4 @@ export interface ReplayIntegrationSuiteOptions<TJob> {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function defineReplayIntegrationSuite<TJob extends object>(source: JobsSource<TJob>, opts: ReplayIntegrationSuiteOptions<TJob>): void;
|
|
49
49
|
export {};
|
|
50
|
-
//# sourceMappingURL=replay-integration-suite.d.
|
|
50
|
+
//# sourceMappingURL=replay-integration-suite.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-integration-suite.d.mts","sourceRoot":"","sources":["../../src/testing/replay-integration-suite.mts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACb,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAI9B,mGAAmG;AACnG,KAAK,UAAU,CAAC,IAAI,IAAI;IAAE,IAAI,EAAE,IAAI,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,6BAA6B,CAAC,IAAI;IACjD,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtE;;;OAGG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC;IAC3D;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,SAAS,MAAM,EAC9D,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EACxB,IAAI,EAAE,6BAA6B,CAAC,IAAI,CAAC,GACxC,IAAI,CA0BN"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Eliminates the repeated describe.skipIf / it.each / runIntegrationJob /
|
|
4
3
|
* message.subject assertion that every replay-based integration test duplicates.
|
|
@@ -6,28 +5,26 @@
|
|
|
6
5
|
* the generic scaffold (file load, INTEGRATION gate, fan-out, default assertion)
|
|
7
6
|
* lives here once.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const vitest_1 = require("vitest");
|
|
14
|
-
const integration_runner_1 = require("../testing/integration-runner");
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { resolve } from "node:path";
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
import { runIntegrationJob } from "../testing/integration-runner.js";
|
|
15
12
|
const DEFAULT_TIMEOUT_MS = 600_000;
|
|
16
13
|
/**
|
|
17
14
|
* Defines a replay-driven integration suite. Pass a `jobs` array or a
|
|
18
15
|
* `jobsPath`+`dirname` pair — the file is read and JSON-parsed at suite
|
|
19
16
|
* definition time. The suite is skipped unless `INTEGRATION=true`.
|
|
20
17
|
*/
|
|
21
|
-
function defineReplayIntegrationSuite(source, opts) {
|
|
18
|
+
export function defineReplayIntegrationSuite(source, opts) {
|
|
22
19
|
const { suiteName, plugin, buildPayload, assertMessage, pollFn } = opts;
|
|
23
20
|
const jobs = "jobs" in source
|
|
24
21
|
? source.jobs
|
|
25
|
-
: JSON.parse(
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
: JSON.parse(readFileSync(resolve(source.dirname, source.jobsPath), "utf8"));
|
|
23
|
+
describe.skipIf(process.env.INTEGRATION !== "true")(suiteName, () => {
|
|
24
|
+
it.each(jobs)(`submits job and receives confirmation email`, {
|
|
28
25
|
timeout: DEFAULT_TIMEOUT_MS,
|
|
29
26
|
}, async (job) => {
|
|
30
|
-
const { message } = await
|
|
27
|
+
const { message } = await runIntegrationJob({
|
|
31
28
|
plugin: plugin,
|
|
32
29
|
baseUrl: job.baseUrl,
|
|
33
30
|
buildPayload: (inbox) => buildPayload(job, inbox),
|
|
@@ -37,9 +34,9 @@ function defineReplayIntegrationSuite(source, opts) {
|
|
|
37
34
|
assertMessage(message, job);
|
|
38
35
|
}
|
|
39
36
|
else {
|
|
40
|
-
|
|
37
|
+
expect(message.subject).toBeTruthy();
|
|
41
38
|
}
|
|
42
39
|
});
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
//# sourceMappingURL=replay-integration-suite.
|
|
42
|
+
//# sourceMappingURL=replay-integration-suite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-integration-suite.mjs","sourceRoot":"","sources":["../../src/testing/replay-integration-suite.mts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAOpE,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAgCnC;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAAwB,EACxB,IAAyC;IAEzC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,IA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