@ontrails/testing 1.0.0-beta.4 → 1.0.0-beta.41
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 +526 -12
- package/README.md +83 -18
- package/package.json +34 -5
- package/src/all-established.ts +168 -0
- package/src/all.ts +51 -12
- package/src/assertions.ts +253 -0
- package/src/cli.ts +6 -0
- package/src/composes.ts +433 -0
- package/src/context.ts +200 -14
- package/src/contracts.ts +44 -33
- package/src/detours.ts +155 -18
- package/src/effective-examples.ts +408 -0
- package/src/errors.ts +47 -0
- package/src/examples.ts +274 -113
- package/src/harness-cli.ts +83 -58
- package/src/harness-http.ts +341 -0
- package/src/harness-mcp.ts +49 -16
- package/src/http.ts +10 -0
- package/src/index.ts +22 -14
- package/src/logger.ts +3 -1
- package/src/mcp.ts +6 -0
- package/src/scenario.ts +375 -0
- package/src/signals.ts +221 -0
- package/src/surface-parity.ts +389 -0
- package/src/trail.ts +1 -1
- package/src/types.ts +24 -52
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/all.d.ts +0 -30
- package/dist/all.d.ts.map +0 -1
- package/dist/all.js +0 -47
- package/dist/all.js.map +0 -1
- package/dist/assertions.d.ts +0 -49
- package/dist/assertions.d.ts.map +0 -1
- package/dist/assertions.js +0 -84
- package/dist/assertions.js.map +0 -1
- package/dist/context.d.ts +0 -19
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -33
- package/dist/context.js.map +0 -1
- package/dist/contracts.d.ts +0 -16
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -66
- package/dist/contracts.js.map +0 -1
- package/dist/detours.d.ts +0 -12
- package/dist/detours.d.ts.map +0 -1
- package/dist/detours.js +0 -30
- package/dist/detours.js.map +0 -1
- package/dist/examples.d.ts +0 -22
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -175
- package/dist/examples.js.map +0 -1
- package/dist/follows.d.ts +0 -32
- package/dist/follows.d.ts.map +0 -1
- package/dist/follows.js +0 -169
- package/dist/follows.js.map +0 -1
- package/dist/harness-cli.d.ts +0 -21
- package/dist/harness-cli.d.ts.map +0 -1
- package/dist/harness-cli.js +0 -213
- package/dist/harness-cli.js.map +0 -1
- package/dist/harness-mcp.d.ts +0 -21
- package/dist/harness-mcp.d.ts.map +0 -1
- package/dist/harness-mcp.js +0 -50
- package/dist/harness-mcp.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -15
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -87
- package/dist/logger.js.map +0 -1
- package/dist/trail.d.ts +0 -20
- package/dist/trail.d.ts.map +0 -1
- package/dist/trail.js +0 -80
- package/dist/trail.js.map +0 -1
- package/dist/types.d.ts +0 -80
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/src/__tests__/context.test.ts +0 -60
- package/src/__tests__/contracts.test.ts +0 -94
- package/src/__tests__/detours.test.ts +0 -55
- package/src/__tests__/examples.test.ts +0 -175
- package/src/__tests__/follows.test.ts +0 -163
- package/src/__tests__/logger.test.ts +0 -136
- package/src/__tests__/trail.test.ts +0 -99
- package/src/follows.ts +0 -283
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/dist/assertions.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progressive assertion logic for example-driven testing.
|
|
3
|
-
*
|
|
4
|
-
* Three tiers:
|
|
5
|
-
* 1. Full match — example has `expected` output
|
|
6
|
-
* 2. Schema-only — no expected output, no error
|
|
7
|
-
* 3. Error match — example declares an error class name
|
|
8
|
-
*/
|
|
9
|
-
import { expect } from 'bun:test';
|
|
10
|
-
import { formatZodIssues } from '@ontrails/core';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Result narrowing helpers
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
/**
|
|
15
|
-
* Assert that a Result is Ok and return its value.
|
|
16
|
-
*
|
|
17
|
-
* Eliminates the `if (result.isOk())` / `as unknown as` dance in tests.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const value = expectOk(result);
|
|
22
|
-
* expect(value.name).toBe('Alice');
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export const expectOk = (result) => {
|
|
26
|
-
expect(result.isOk()).toBe(true);
|
|
27
|
-
return result.value;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Assert that a Result is Err and return its error.
|
|
31
|
-
*
|
|
32
|
-
* Eliminates the `if (result.isErr())` / `as unknown as` dance in tests.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const error = expectErr(result);
|
|
37
|
-
* expect(error).toBeInstanceOf(ValidationError);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export const expectErr = (result) => {
|
|
41
|
-
expect(result.isErr()).toBe(true);
|
|
42
|
-
return result.error;
|
|
43
|
-
};
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
// Full Match
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
/**
|
|
48
|
-
* Assert that the result is ok and its value deep-equals the expected output.
|
|
49
|
-
*/
|
|
50
|
-
export const assertFullMatch = (result, expected) => {
|
|
51
|
-
const value = expectOk(result);
|
|
52
|
-
expect(value).toEqual(expected);
|
|
53
|
-
};
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
// Schema-Only Match
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
/**
|
|
58
|
-
* Assert that the result is ok and, if an output schema is provided,
|
|
59
|
-
* the value parses against it.
|
|
60
|
-
*/
|
|
61
|
-
export const assertSchemaMatch = (result, outputSchema) => {
|
|
62
|
-
const value = expectOk(result);
|
|
63
|
-
if (outputSchema !== undefined) {
|
|
64
|
-
const parsed = outputSchema.safeParse(value);
|
|
65
|
-
if (!parsed.success) {
|
|
66
|
-
throw new Error(`Output does not match schema: ${formatZodIssues(parsed.error.issues).join('; ')}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
// ---------------------------------------------------------------------------
|
|
71
|
-
// Error Match
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
/**
|
|
74
|
-
* Assert that the result is an error of the specified type, with optional
|
|
75
|
-
* message substring matching.
|
|
76
|
-
*/
|
|
77
|
-
export const assertErrorMatch = (result, expectedError, expectedMessage) => {
|
|
78
|
-
const error = expectErr(result);
|
|
79
|
-
expect(error).toBeInstanceOf(expectedError);
|
|
80
|
-
if (expectedMessage !== undefined) {
|
|
81
|
-
expect(error.message).toContain(expectedMessage);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=assertions.js.map
|
package/dist/assertions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAO,MAAoB,EAAK,EAAE;IACxD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,OAAQ,MAAkC,CAAC,KAAK,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,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CAAC,CAAC;IAC5C,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/context.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test context factory for creating TrailContext instances suitable for testing.
|
|
3
|
-
*/
|
|
4
|
-
import type { TrailContext } from '@ontrails/core';
|
|
5
|
-
import type { TestTrailContextOptions } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Create a TrailContext with deterministic, test-friendly defaults.
|
|
8
|
-
*
|
|
9
|
-
* - `requestId`: `"test-request-001"` (deterministic)
|
|
10
|
-
* - `logger`: a `TestLogger` that captures entries
|
|
11
|
-
* - `signal`: a non-aborted AbortController signal
|
|
12
|
-
*/
|
|
13
|
-
export declare const createTestContext: (overrides?: TestTrailContextOptions) => TrailContext;
|
|
14
|
-
/**
|
|
15
|
-
* Merge a Partial<TrailContext> into a test context.
|
|
16
|
-
* Used internally when the public API accepts Partial<TrailContext>.
|
|
17
|
-
*/
|
|
18
|
-
export declare const mergeTestContext: (ctx?: Partial<TrailContext>) => TrailContext;
|
|
19
|
-
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAM1D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,uBAAuB,KAClC,YAMD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,OAAO,CAAC,YAAY,CAAC,KAAG,YAO9D,CAAC"}
|
package/dist/context.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test context factory for creating TrailContext instances suitable for testing.
|
|
3
|
-
*/
|
|
4
|
-
import { createTestLogger } from './logger.js';
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// createTestContext
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
/**
|
|
9
|
-
* Create a TrailContext with deterministic, test-friendly defaults.
|
|
10
|
-
*
|
|
11
|
-
* - `requestId`: `"test-request-001"` (deterministic)
|
|
12
|
-
* - `logger`: a `TestLogger` that captures entries
|
|
13
|
-
* - `signal`: a non-aborted AbortController signal
|
|
14
|
-
*/
|
|
15
|
-
export const createTestContext = (overrides) => ({
|
|
16
|
-
env: overrides?.env ?? { TRAILS_ENV: 'test' },
|
|
17
|
-
logger: overrides?.logger ?? createTestLogger(),
|
|
18
|
-
requestId: overrides?.requestId ?? 'test-request-001',
|
|
19
|
-
signal: overrides?.signal ?? new AbortController().signal,
|
|
20
|
-
workspaceRoot: overrides?.cwd ?? process.cwd(),
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Merge a Partial<TrailContext> into a test context.
|
|
24
|
-
* Used internally when the public API accepts Partial<TrailContext>.
|
|
25
|
-
*/
|
|
26
|
-
export const mergeTestContext = (ctx) => {
|
|
27
|
-
if (ctx === undefined) {
|
|
28
|
-
return createTestContext();
|
|
29
|
-
}
|
|
30
|
-
const base = createTestContext();
|
|
31
|
-
return { ...base, ...ctx };
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAmC,EACrB,EAAE,CAAC,CAAC;IAClB,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE;IAC7C,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,gBAAgB,EAAE;IAC/C,SAAS,EAAE,SAAS,EAAE,SAAS,IAAI,kBAAkB;IACrD,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC,MAAM;IACzD,aAAa,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;CAC/C,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAA2B,EAAgB,EAAE;IAC5E,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/contracts.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testContracts — output schema verification.
|
|
3
|
-
*
|
|
4
|
-
* For every trail that has both examples and an output schema,
|
|
5
|
-
* run each example and validate the implementation output against
|
|
6
|
-
* the declared schema.
|
|
7
|
-
*/
|
|
8
|
-
import type { Topo, TrailContext } from '@ontrails/core';
|
|
9
|
-
/**
|
|
10
|
-
* Verify that every trail implementation output matches its declared
|
|
11
|
-
* output schema. Catches implementation-schema drift.
|
|
12
|
-
*
|
|
13
|
-
* Trails without output schemas or examples are skipped.
|
|
14
|
-
*/
|
|
15
|
-
export declare const testContracts: (app: Topo, ctxOrFactory?: Partial<TrailContext> | (() => Partial<TrailContext>)) => void;
|
|
16
|
-
//# sourceMappingURL=contracts.d.ts.map
|
package/dist/contracts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAuB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA0C9E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,IAAI,EACT,eAAe,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,KACnE,IAoCF,CAAC"}
|
package/dist/contracts.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testContracts — output schema verification.
|
|
3
|
-
*
|
|
4
|
-
* For every trail that has both examples and an output schema,
|
|
5
|
-
* run each example and validate the implementation output against
|
|
6
|
-
* the declared schema.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, test } from 'bun:test';
|
|
9
|
-
import { formatZodIssues, validateInput } from '@ontrails/core';
|
|
10
|
-
import { expectOk } from './assertions.js';
|
|
11
|
-
import { mergeTestContext } from './context.js';
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// Helpers
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
/** Check if a trail requires follow() but the context doesn't provide it. */
|
|
16
|
-
const needsFollowContext = (t, resolveCtx) => {
|
|
17
|
-
const spec = t;
|
|
18
|
-
if (!spec.follow || spec.follow.length === 0) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return !resolveCtx()?.follow;
|
|
22
|
-
};
|
|
23
|
-
const validateOutputSchema = (outputSchema, value, trailId, exampleName) => {
|
|
24
|
-
const parsed = outputSchema.safeParse(value);
|
|
25
|
-
if (!parsed.success) {
|
|
26
|
-
const issues = formatZodIssues(parsed.error.issues);
|
|
27
|
-
throw new Error(`Output schema violation for trail "${trailId}", example "${exampleName}":\n${issues.map((i) => ` - ${i}`).join('\n')}\n\nActual output: ${JSON.stringify(value, null, 2)}`);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
// testContracts
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
/**
|
|
34
|
-
* Verify that every trail implementation output matches its declared
|
|
35
|
-
* output schema. Catches implementation-schema drift.
|
|
36
|
-
*
|
|
37
|
-
* Trails without output schemas or examples are skipped.
|
|
38
|
-
*/
|
|
39
|
-
export const testContracts = (app, ctxOrFactory) => {
|
|
40
|
-
const resolveCtx = typeof ctxOrFactory === 'function' ? ctxOrFactory : () => ctxOrFactory;
|
|
41
|
-
const allEntries = app.list();
|
|
42
|
-
describe('contracts', () => {
|
|
43
|
-
describe.each(allEntries)('$id', (t) => {
|
|
44
|
-
if (t.output === undefined) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (t.examples === undefined || t.examples.length === 0) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (needsFollowContext(t, resolveCtx)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const { examples, output: outputSchema } = t;
|
|
54
|
-
const successExamples = examples.filter((e) => e.error === undefined);
|
|
55
|
-
test.each(successExamples)('contract: $name', async (example) => {
|
|
56
|
-
const testCtx = mergeTestContext(resolveCtx());
|
|
57
|
-
const validated = validateInput(t.input, example.input);
|
|
58
|
-
const validatedInput = expectOk(validated);
|
|
59
|
-
const result = await t.run(validatedInput, testCtx);
|
|
60
|
-
const resultValue = expectOk(result);
|
|
61
|
-
validateOutputSchema(outputSchema, resultValue, t.id, example.name);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=contracts.js.map
|
package/dist/contracts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"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AC,cAAc,EAAE,OAAO,CAAC,CAAC;gBACpD,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAErC,oBAAoB,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YACtE,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/detours.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testDetours — verify that all detour targets exist in the topo.
|
|
3
|
-
*
|
|
4
|
-
* Pure structural validation. No implementation execution needed.
|
|
5
|
-
*/
|
|
6
|
-
import type { Topo } from '@ontrails/core';
|
|
7
|
-
/**
|
|
8
|
-
* Verify that every trail's detour targets reference trails that
|
|
9
|
-
* actually exist in the app's topo.
|
|
10
|
-
*/
|
|
11
|
-
export declare const testDetours: (app: Topo) => void;
|
|
12
|
-
//# sourceMappingURL=detours.d.ts.map
|
package/dist/detours.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detours.d.ts","sourceRoot":"","sources":["../src/detours.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,IAAI,KAAG,IAyBvC,CAAC"}
|
package/dist/detours.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testDetours — verify that all detour targets exist in the topo.
|
|
3
|
-
*
|
|
4
|
-
* Pure structural validation. No implementation execution needed.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, expect, test } from 'bun:test';
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
// testDetours
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
/**
|
|
11
|
-
* Verify that every trail's detour targets reference trails that
|
|
12
|
-
* actually exist in the app's topo.
|
|
13
|
-
*/
|
|
14
|
-
export const testDetours = (app) => {
|
|
15
|
-
const trailEntries = [...app.trails];
|
|
16
|
-
describe('detours', () => {
|
|
17
|
-
describe.each(trailEntries)('%s', (_id, trailDef) => {
|
|
18
|
-
const t = trailDef;
|
|
19
|
-
if (t.detours === undefined) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const { detours } = t;
|
|
23
|
-
const testCases = Object.entries(detours).flatMap(([detourName, targets]) => targets.map((targetId) => ({ detourName, targetId })));
|
|
24
|
-
test.each(testCases)('detour "$detourName" -> "$targetId" exists', ({ targetId }) => {
|
|
25
|
-
expect(app.has(targetId)).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=detours.js.map
|
package/dist/detours.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detours.js","sourceRoot":"","sources":["../src/detours.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIlD,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAS,EAAQ,EAAE;IAC7C,MAAM,YAAY,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAErC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YAClD,MAAM,CAAC,GAAG,QAAmC,CAAC;YAE9C,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO;YACT,CAAC;YAED,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;YACtB,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAC/C,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,EAAE,CACxB,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CACxD,CAAC;YAEF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAClB,4CAA4C,EAC5C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACf,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/examples.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testExamples — the headline one-liner.
|
|
3
|
-
*
|
|
4
|
-
* Iterates every trail in the app's topo. For each trail with examples,
|
|
5
|
-
* generates describe/test blocks using bun:test. Progressive assertion
|
|
6
|
-
* determines which check to run per example. For trails with `follow`
|
|
7
|
-
* declarations, checks that every declared follow was called at least once.
|
|
8
|
-
*/
|
|
9
|
-
import type { Topo, TrailContext } from '@ontrails/core';
|
|
10
|
-
/**
|
|
11
|
-
* Generate describe/test blocks for every trail example in the app.
|
|
12
|
-
*
|
|
13
|
-
* For trails with `follow` declarations and examples, also verifies that
|
|
14
|
-
* every declared follow ID was called at least once across all examples.
|
|
15
|
-
*
|
|
16
|
-
* One line in your test file:
|
|
17
|
-
* ```ts
|
|
18
|
-
* testExamples(app);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const testExamples: (app: Topo, ctxOrFactory?: Partial<TrailContext> | (() => Partial<TrailContext>)) => void;
|
|
22
|
-
//# sourceMappingURL=examples.d.ts.map
|
package/dist/examples.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../src/examples.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAEV,IAAI,EAGJ,YAAY,EACb,MAAM,gBAAgB,CAAC;AAiMxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,IAAI,EACT,eAAe,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,KACnE,IAqDF,CAAC"}
|
package/dist/examples.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testExamples — the headline one-liner.
|
|
3
|
-
*
|
|
4
|
-
* Iterates every trail in the app's topo. For each trail with examples,
|
|
5
|
-
* generates describe/test blocks using bun:test. Progressive assertion
|
|
6
|
-
* determines which check to run per example. For trails with `follow`
|
|
7
|
-
* declarations, checks that every declared follow was called at least once.
|
|
8
|
-
*/
|
|
9
|
-
import { describe, expect, test } from 'bun:test';
|
|
10
|
-
import { AlreadyExistsError, AmbiguousError, AssertionError, AuthError, CancelledError, ConflictError, InternalError, NetworkError, NotFoundError, PermissionError, RateLimitError, Result, TimeoutError, TrailsError, ValidationError, validateInput, } from '@ontrails/core';
|
|
11
|
-
import { assertErrorMatch, assertFullMatch, assertSchemaMatch, expectOk, } from './assertions.js';
|
|
12
|
-
import { mergeTestContext } from './context.js';
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// Error class name -> constructor map
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
const ERROR_MAP = {
|
|
17
|
-
AlreadyExistsError: AlreadyExistsError,
|
|
18
|
-
AmbiguousError: AmbiguousError,
|
|
19
|
-
AssertionError: AssertionError,
|
|
20
|
-
AuthError: AuthError,
|
|
21
|
-
CancelledError: CancelledError,
|
|
22
|
-
ConflictError: ConflictError,
|
|
23
|
-
InternalError: InternalError,
|
|
24
|
-
NetworkError: NetworkError,
|
|
25
|
-
NotFoundError: NotFoundError,
|
|
26
|
-
PermissionError: PermissionError,
|
|
27
|
-
RateLimitError: RateLimitError,
|
|
28
|
-
TimeoutError: TimeoutError,
|
|
29
|
-
TrailsError: TrailsError,
|
|
30
|
-
ValidationError: ValidationError,
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Resolve an error class name string to the actual constructor.
|
|
34
|
-
* Falls back to generic Error if the name is not in the core taxonomy.
|
|
35
|
-
*/
|
|
36
|
-
const resolveErrorClass = (name) => ERROR_MAP[name] ?? Error;
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
// Helpers
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
const assertProgressiveMatch = (result, example, output) => {
|
|
41
|
-
if (example.expected !== undefined) {
|
|
42
|
-
assertFullMatch(result, example.expected);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (example.error !== undefined) {
|
|
46
|
-
const errorClass = resolveErrorClass(example.error);
|
|
47
|
-
assertErrorMatch(result, errorClass);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
assertSchemaMatch(result, output);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Handle input validation failure for an example.
|
|
54
|
-
* Returns true if the validation error was expected (and assertions passed).
|
|
55
|
-
* Throws if the validation error was unexpected.
|
|
56
|
-
*/
|
|
57
|
-
const handleValidationError = (validated, example) => {
|
|
58
|
-
if (!validated.isErr()) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (example.error !== undefined) {
|
|
62
|
-
const errorClass = resolveErrorClass(example.error);
|
|
63
|
-
expect(validated.error).toBeInstanceOf(errorClass);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
throw new Error(`Example "${example.name}" has invalid input: ${validated.error.message}`);
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Run a single example against a trail.
|
|
70
|
-
* Handles validation, execution, and assertions.
|
|
71
|
-
*/
|
|
72
|
-
const runExample = async (t, example, output, testCtx) => {
|
|
73
|
-
const validated = validateInput(t.input, example.input);
|
|
74
|
-
if (handleValidationError(validated, example)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const validatedInput = expectOk(validated);
|
|
78
|
-
const result = await t.run(validatedInput, testCtx);
|
|
79
|
-
assertProgressiveMatch(result, example, output);
|
|
80
|
-
};
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
// Follow coverage for composition trails
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
/**
|
|
85
|
-
* Build a recording follow function that tracks which trail IDs are called.
|
|
86
|
-
*
|
|
87
|
-
* Delegates to `baseFollow` when available, otherwise looks up the trail
|
|
88
|
-
* in the topo and executes it with validated input. Falls back to
|
|
89
|
-
* `Result.ok()` when neither is available.
|
|
90
|
-
*/
|
|
91
|
-
const createCoverageFollow = (called, baseFollow, topo, ctx) => {
|
|
92
|
-
const follow = (id, input) => {
|
|
93
|
-
called.add(id);
|
|
94
|
-
if (baseFollow !== undefined) {
|
|
95
|
-
return baseFollow(id, input);
|
|
96
|
-
}
|
|
97
|
-
const trailDef = topo.get(id);
|
|
98
|
-
if (trailDef !== undefined) {
|
|
99
|
-
const validated = validateInput(trailDef.input, input);
|
|
100
|
-
if (validated.isErr()) {
|
|
101
|
-
return Promise.resolve(validated);
|
|
102
|
-
}
|
|
103
|
-
return Promise.resolve(trailDef.run(validated.value, ctx));
|
|
104
|
-
}
|
|
105
|
-
return Promise.resolve(Result.ok());
|
|
106
|
-
};
|
|
107
|
-
return follow;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Run a single example against a composition trail, recording follow calls.
|
|
111
|
-
*/
|
|
112
|
-
const runCompositionExample = async (trailDef, example, output, baseCtx, called, topo) => {
|
|
113
|
-
const validated = validateInput(trailDef.input, example.input);
|
|
114
|
-
if (handleValidationError(validated, example)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const validatedInput = expectOk(validated);
|
|
118
|
-
const follow = createCoverageFollow(called, baseCtx.follow, topo, baseCtx);
|
|
119
|
-
const testCtx = { ...baseCtx, follow };
|
|
120
|
-
const result = await trailDef.run(validatedInput, testCtx);
|
|
121
|
-
assertProgressiveMatch(result, example, output);
|
|
122
|
-
};
|
|
123
|
-
// ---------------------------------------------------------------------------
|
|
124
|
-
// testExamples
|
|
125
|
-
// ---------------------------------------------------------------------------
|
|
126
|
-
/**
|
|
127
|
-
* Generate describe/test blocks for every trail example in the app.
|
|
128
|
-
*
|
|
129
|
-
* For trails with `follow` declarations and examples, also verifies that
|
|
130
|
-
* every declared follow ID was called at least once across all examples.
|
|
131
|
-
*
|
|
132
|
-
* One line in your test file:
|
|
133
|
-
* ```ts
|
|
134
|
-
* testExamples(app);
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export const testExamples = (app, ctxOrFactory) => {
|
|
138
|
-
const resolveCtx = typeof ctxOrFactory === 'function' ? ctxOrFactory : () => ctxOrFactory;
|
|
139
|
-
const allTrails = app.list();
|
|
140
|
-
const withExamples = allTrails.filter((t) => t.examples !== undefined && t.examples.length > 0);
|
|
141
|
-
const simpleTrails = withExamples.filter((t) => t.follow.length === 0);
|
|
142
|
-
const compositionTrails = withExamples.filter((t) => t.follow.length > 0);
|
|
143
|
-
// Simple trails: run examples directly
|
|
144
|
-
if (simpleTrails.length > 0) {
|
|
145
|
-
describe.each(simpleTrails)('$id', (t) => {
|
|
146
|
-
const { examples, output } = t;
|
|
147
|
-
if (!examples) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
test.each([...examples])('example: $name', async (example) => {
|
|
151
|
-
const testCtx = mergeTestContext(resolveCtx());
|
|
152
|
-
await runExample(t, example, output, testCtx);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
// Composition trails: use recording follow and check coverage
|
|
157
|
-
if (compositionTrails.length > 0) {
|
|
158
|
-
describe.each(compositionTrails)('$id', (t) => {
|
|
159
|
-
const { examples, output } = t;
|
|
160
|
-
if (!examples) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const called = new Set();
|
|
164
|
-
test.each([...examples])('example: $name', async (example) => {
|
|
165
|
-
const baseCtx = mergeTestContext(resolveCtx());
|
|
166
|
-
await runCompositionExample(t, example, output, baseCtx, called, app);
|
|
167
|
-
});
|
|
168
|
-
test('follow coverage', () => {
|
|
169
|
-
const uncovered = t.follow.filter((id) => !called.has(id));
|
|
170
|
-
expect(uncovered).toEqual([]);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
//# sourceMappingURL=examples.js.map
|
package/dist/examples.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../src/examples.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAUlD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,MAAM,EACN,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,8EAA8E;AAC9E,sCAAsC;AACtC,8EAA8E;AAE9E,MAAM,SAAS,GAAoD;IACjE,kBAAkB,EAAE,kBAAqD;IACzE,cAAc,EAAE,cAAiD;IACjE,cAAc,EAAE,cAAiD;IACjE,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AC,CAAC,CAAC;IACL,CAAC;IAED,8DAA8D;IAC9D,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;YAC5C,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO;YACT,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;YAEjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CACtB,gBAAgB,EAChB,KAAK,EAAE,OAAuC,EAAE,EAAE;gBAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC/C,MAAM,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YACxE,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;gBAC3B,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
package/dist/follows.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testFollows — composition-aware scenario testing for trails with follow.
|
|
3
|
-
*
|
|
4
|
-
* Tests the follow graph: which trails were followed, in what order,
|
|
5
|
-
* and supports failure injection from followed trail examples.
|
|
6
|
-
*/
|
|
7
|
-
import type { AnyTrail, TrailContext } from '@ontrails/core';
|
|
8
|
-
import type { FollowScenario } from './types.js';
|
|
9
|
-
/** Options for testFollows that provide trail definitions for injection. */
|
|
10
|
-
export interface TestFollowOptions {
|
|
11
|
-
/** Partial context overrides. */
|
|
12
|
-
readonly ctx?: Partial<TrailContext> | undefined;
|
|
13
|
-
/** Map of trail ID to trail definition, used for injectFromExample. */
|
|
14
|
-
readonly trails?: ReadonlyMap<string, AnyTrail> | undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Generate a describe block for a composition trail with one test per scenario.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* testFollows(onboardTrail, [
|
|
22
|
-
* {
|
|
23
|
-
* description: "follows add then relate",
|
|
24
|
-
* input: { name: "Alpha" },
|
|
25
|
-
* expectOk: true,
|
|
26
|
-
* expectFollowed: ["entity.add", "entity.relate"],
|
|
27
|
-
* },
|
|
28
|
-
* ]);
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare const testFollows: (trailDef: AnyTrail, scenarios: readonly FollowScenario[], options?: TestFollowOptions) => void;
|
|
32
|
-
//# sourceMappingURL=follows.d.ts.map
|
package/dist/follows.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"follows.d.ts","sourceRoot":"","sources":["../src/follows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAevE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA8NjD,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACjD,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;CAC7D;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,QAAQ,EAClB,WAAW,SAAS,cAAc,EAAE,EACpC,UAAU,iBAAiB,KAC1B,IASF,CAAC"}
|