@holokai/holo-test 1.4.2
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 +171 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +83 -0
- package/dist/cli.js.map +1 -0
- package/dist/contracts/audit-contract.d.ts +3 -0
- package/dist/contracts/audit-contract.d.ts.map +1 -0
- package/dist/contracts/audit-contract.js +11 -0
- package/dist/contracts/audit-contract.js.map +1 -0
- package/dist/contracts/pipeline-contract.d.ts +3 -0
- package/dist/contracts/pipeline-contract.d.ts.map +1 -0
- package/dist/contracts/pipeline-contract.js +9 -0
- package/dist/contracts/pipeline-contract.js.map +1 -0
- package/dist/contracts/roundtrip-contract.d.ts +3 -0
- package/dist/contracts/roundtrip-contract.d.ts.map +1 -0
- package/dist/contracts/roundtrip-contract.js +9 -0
- package/dist/contracts/roundtrip-contract.js.map +1 -0
- package/dist/contracts/wire-contract.d.ts +3 -0
- package/dist/contracts/wire-contract.d.ts.map +1 -0
- package/dist/contracts/wire-contract.js +9 -0
- package/dist/contracts/wire-contract.js.map +1 -0
- package/dist/dsl/assertions.d.ts +6 -0
- package/dist/dsl/assertions.d.ts.map +1 -0
- package/dist/dsl/assertions.js +54 -0
- package/dist/dsl/assertions.js.map +1 -0
- package/dist/dsl/suite-builder.d.ts +25 -0
- package/dist/dsl/suite-builder.d.ts.map +1 -0
- package/dist/dsl/suite-builder.js +96 -0
- package/dist/dsl/suite-builder.js.map +1 -0
- package/dist/factories/worker-request-factory.d.ts +5 -0
- package/dist/factories/worker-request-factory.d.ts.map +1 -0
- package/dist/factories/worker-request-factory.js +19 -0
- package/dist/factories/worker-request-factory.js.map +1 -0
- package/dist/fixtures/fixture-loader.d.ts +6 -0
- package/dist/fixtures/fixture-loader.d.ts.map +1 -0
- package/dist/fixtures/fixture-loader.js +23 -0
- package/dist/fixtures/fixture-loader.js.map +1 -0
- package/dist/helpers/env.d.ts +7 -0
- package/dist/helpers/env.d.ts.map +1 -0
- package/dist/helpers/env.js +18 -0
- package/dist/helpers/env.js.map +1 -0
- package/dist/helpers/matrix.d.ts +37 -0
- package/dist/helpers/matrix.d.ts.map +1 -0
- package/dist/helpers/matrix.js +43 -0
- package/dist/helpers/matrix.js.map +1 -0
- package/dist/helpers/mock-fetch.d.ts +10 -0
- package/dist/helpers/mock-fetch.d.ts.map +1 -0
- package/dist/helpers/mock-fetch.js +34 -0
- package/dist/helpers/mock-fetch.js.map +1 -0
- package/dist/helpers/stream-helpers.d.ts +4 -0
- package/dist/helpers/stream-helpers.d.ts.map +1 -0
- package/dist/helpers/stream-helpers.js +17 -0
- package/dist/helpers/stream-helpers.js.map +1 -0
- package/dist/helpers/vitest-helpers.d.ts +3 -0
- package/dist/helpers/vitest-helpers.d.ts.map +1 -0
- package/dist/helpers/vitest-helpers.js +13 -0
- package/dist/helpers/vitest-helpers.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/live/assertions.d.ts +8 -0
- package/dist/live/assertions.d.ts.map +1 -0
- package/dist/live/assertions.js +55 -0
- package/dist/live/assertions.js.map +1 -0
- package/dist/live/env.d.ts +4 -0
- package/dist/live/env.d.ts.map +1 -0
- package/dist/live/env.js +19 -0
- package/dist/live/env.js.map +1 -0
- package/dist/live/index.d.ts +6 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +5 -0
- package/dist/live/index.js.map +1 -0
- package/dist/live/live-tester.d.ts +3 -0
- package/dist/live/live-tester.d.ts.map +1 -0
- package/dist/live/live-tester.js +78 -0
- package/dist/live/live-tester.js.map +1 -0
- package/dist/live/payloads.d.ts +5 -0
- package/dist/live/payloads.d.ts.map +1 -0
- package/dist/live/payloads.js +38 -0
- package/dist/live/payloads.js.map +1 -0
- package/dist/live/types.d.ts +17 -0
- package/dist/live/types.d.ts.map +1 -0
- package/dist/live/types.js +2 -0
- package/dist/live/types.js.map +1 -0
- package/dist/runner/test-reporter.d.ts +3 -0
- package/dist/runner/test-reporter.d.ts.map +1 -0
- package/dist/runner/test-reporter.js +43 -0
- package/dist/runner/test-reporter.js.map +1 -0
- package/dist/runner/test-runner.d.ts +12 -0
- package/dist/runner/test-runner.d.ts.map +1 -0
- package/dist/runner/test-runner.js +37 -0
- package/dist/runner/test-runner.js.map +1 -0
- package/dist/services/http-fixture-server.d.ts +14 -0
- package/dist/services/http-fixture-server.d.ts.map +1 -0
- package/dist/services/http-fixture-server.js +93 -0
- package/dist/services/http-fixture-server.js.map +1 -0
- package/dist/services/ndjson-parser.d.ts +2 -0
- package/dist/services/ndjson-parser.d.ts.map +1 -0
- package/dist/services/ndjson-parser.js +7 -0
- package/dist/services/ndjson-parser.js.map +1 -0
- package/dist/services/plugin-loader.d.ts +7 -0
- package/dist/services/plugin-loader.d.ts.map +1 -0
- package/dist/services/plugin-loader.js +32 -0
- package/dist/services/plugin-loader.js.map +1 -0
- package/dist/services/sse-parser.d.ts +6 -0
- package/dist/services/sse-parser.d.ts.map +1 -0
- package/dist/services/sse-parser.js +22 -0
- package/dist/services/sse-parser.js.map +1 -0
- package/dist/testers/audit-tester.d.ts +4 -0
- package/dist/testers/audit-tester.d.ts.map +1 -0
- package/dist/testers/audit-tester.js +74 -0
- package/dist/testers/audit-tester.js.map +1 -0
- package/dist/testers/pipeline-tester.d.ts +4 -0
- package/dist/testers/pipeline-tester.d.ts.map +1 -0
- package/dist/testers/pipeline-tester.js +62 -0
- package/dist/testers/pipeline-tester.js.map +1 -0
- package/dist/testers/roundtrip-tester.d.ts +3 -0
- package/dist/testers/roundtrip-tester.d.ts.map +1 -0
- package/dist/testers/roundtrip-tester.js +77 -0
- package/dist/testers/roundtrip-tester.js.map +1 -0
- package/dist/testers/wire-tester.d.ts +4 -0
- package/dist/testers/wire-tester.d.ts.map +1 -0
- package/dist/testers/wire-tester.js +87 -0
- package/dist/testers/wire-tester.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# @holokai/holo-test
|
|
2
|
+
|
|
3
|
+
Conformance testing framework for Holo provider plugins. Provides fixture-driven testers, vitest contracts, a fluent DSL, and a CLI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @holokai/holo-test
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `vitest ^3.0.0`, `tsyringe ^4.10.0`
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import {describe, it} from 'vitest';
|
|
17
|
+
import {loadFixtures, runWireContract} from '@holokai/holo-test';
|
|
18
|
+
|
|
19
|
+
const fixtures = loadFixtures('./tests/fixtures', {plugin: 'openai'});
|
|
20
|
+
|
|
21
|
+
describe('openai wire conformance', () => {
|
|
22
|
+
for (const fixture of fixtures) {
|
|
23
|
+
it(fixture.name, async () => {
|
|
24
|
+
await runWireContract('openai', fixture);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Testing Modes
|
|
31
|
+
|
|
32
|
+
| Mode | What it Tests | Function |
|
|
33
|
+
|------|--------------|----------|
|
|
34
|
+
| **Wire** | Provider events serialize to correct HTTP wire chunks (SSE/JSON) | `testWire()` / `runWireContract()` |
|
|
35
|
+
| **Audit** | Worker requests produce correct `ProviderRequest`/`ProviderResponse` audit records | `testAudit()` / `runAuditContract()` |
|
|
36
|
+
| **Pipeline** | End-to-end: payload in, events out, text accumulated, done event emitted | `testPipeline()` / `runPipelineContract()` |
|
|
37
|
+
| **RoundTrip** | SDK request → HTTP fixture server → SDK response matches expected output | `testRoundTrip()` / `runRoundTripContract()` |
|
|
38
|
+
|
|
39
|
+
## Fixtures
|
|
40
|
+
|
|
41
|
+
Create `.fixture.ts` files that export a `FixtureScenario`:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import type {FixtureScenario} from '@holokai/holo-test';
|
|
45
|
+
|
|
46
|
+
const fixture: FixtureScenario = {
|
|
47
|
+
name: 'simple chat completion',
|
|
48
|
+
plugin: 'openai',
|
|
49
|
+
protocol: 'openai.chatCompletions',
|
|
50
|
+
streaming: false,
|
|
51
|
+
|
|
52
|
+
providerChunks: [/* mock provider response objects */],
|
|
53
|
+
|
|
54
|
+
expectedText: 'Hello, world!',
|
|
55
|
+
expectedWire: ['{"id":"chatcmpl-...}'],
|
|
56
|
+
expectedStatus: 200,
|
|
57
|
+
expectedHeaders: {'content-type': 'application/json'},
|
|
58
|
+
|
|
59
|
+
expectedAudit: {
|
|
60
|
+
access_model: 'gpt-4o',
|
|
61
|
+
input_tokens: 10,
|
|
62
|
+
output_tokens: 5,
|
|
63
|
+
status: 'success',
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
tags: ['chat', 'non-streaming'],
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default fixture;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Load fixtures:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import {loadFixtures} from '@holokai/holo-test';
|
|
76
|
+
|
|
77
|
+
// All fixtures
|
|
78
|
+
const all = loadFixtures('./tests/fixtures');
|
|
79
|
+
|
|
80
|
+
// Filtered
|
|
81
|
+
const streaming = loadFixtures('./tests/fixtures', {plugin: 'openai', tag: 'streaming'});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Suite DSL
|
|
85
|
+
|
|
86
|
+
Fluent builder for running multiple test modes:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import {suite} from '@holokai/holo-test';
|
|
90
|
+
|
|
91
|
+
await suite()
|
|
92
|
+
.forPlugin('openai')
|
|
93
|
+
.fixtureDir('./tests/fixtures')
|
|
94
|
+
.wire()
|
|
95
|
+
.audit()
|
|
96
|
+
.pipeline()
|
|
97
|
+
.verbose()
|
|
98
|
+
.run();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Vitest Contracts
|
|
102
|
+
|
|
103
|
+
Import contract functions directly into vitest test files:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import {runWireContract, runAuditContract, runPipelineContract} from '@holokai/holo-test';
|
|
107
|
+
|
|
108
|
+
describe('openai conformance', () => {
|
|
109
|
+
it('wire: simple chat', async () => {
|
|
110
|
+
await runWireContract('openai', fixture);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('audit: simple chat', async () => {
|
|
114
|
+
await runAuditContract('openai', fixture);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('pipeline: simple chat', async () => {
|
|
118
|
+
await runPipelineContract('openai', fixture);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## CLI
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx holo-test --fixture-dir ./tests/fixtures --plugin openai
|
|
127
|
+
npx holo-test --fixture-dir ./tests/fixtures --plugin claude --tag streaming --verbose
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Live Testing
|
|
131
|
+
|
|
132
|
+
Test against real provider APIs:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import {runLiveTest, isProviderAvailable} from '@holokai/holo-test';
|
|
136
|
+
|
|
137
|
+
if (isProviderAvailable('openai')) {
|
|
138
|
+
const results = await runLiveTest({
|
|
139
|
+
families: ['openai'],
|
|
140
|
+
timeout: 30000,
|
|
141
|
+
});
|
|
142
|
+
console.log(results);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Environment variables for live tests:
|
|
147
|
+
- `OPENAI_API_KEY`, `CLAUDE_API_KEY`, `GEMINI_API_KEY`, `OLLAMA_HOST`
|
|
148
|
+
- `OPENAI_MODEL`, `CLAUDE_MODEL`, etc. (override default test models)
|
|
149
|
+
|
|
150
|
+
## Helpers
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
loadPlugin, // Load and initialize a plugin by family name
|
|
155
|
+
parseSseBody, // Parse SSE response body into frames
|
|
156
|
+
parseNdjsonBody, // Parse NDJSON response body
|
|
157
|
+
createMockFetch, // Mock fetch for unit tests
|
|
158
|
+
createSseMockFetch, // Mock SSE streaming responses
|
|
159
|
+
collectStreamText, // Extract all text from a stream
|
|
160
|
+
collectStreamEvents, // Collect all events from a stream
|
|
161
|
+
HttpFixtureServer, // Mock HTTP server serving fixture responses
|
|
162
|
+
createTestWorkerRequest, // Build a HoloWorkerRequest from a fixture
|
|
163
|
+
createTestEnvelope, // Build a WorkerResponseEnvelope from a fixture
|
|
164
|
+
discoverProviders, // Discover available providers via gateway
|
|
165
|
+
assertTestResult, // Assert a TestResult passed (throws on failure)
|
|
166
|
+
} from '@holokai/holo-test';
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,kBAAkB,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { runTests } from './runner/test-runner.js';
|
|
5
|
+
function parseArgs(argv) {
|
|
6
|
+
const args = argv.slice(2);
|
|
7
|
+
const options = {};
|
|
8
|
+
for (let i = 0; i < args.length; i++) {
|
|
9
|
+
const arg = args[i];
|
|
10
|
+
if (arg === '--plugin' && i + 1 < args.length) {
|
|
11
|
+
options.plugin = args[++i];
|
|
12
|
+
}
|
|
13
|
+
else if (arg === '--tag' && i + 1 < args.length) {
|
|
14
|
+
options.tag = args[++i];
|
|
15
|
+
}
|
|
16
|
+
else if (arg === '--fixtures' && i + 1 < args.length) {
|
|
17
|
+
options.fixtureDir = args[++i];
|
|
18
|
+
}
|
|
19
|
+
else if (arg === '--wire') {
|
|
20
|
+
options.wire = true;
|
|
21
|
+
}
|
|
22
|
+
else if (arg === '--audit') {
|
|
23
|
+
options.audit = true;
|
|
24
|
+
}
|
|
25
|
+
else if (arg === '--pipeline') {
|
|
26
|
+
options.pipeline = true;
|
|
27
|
+
}
|
|
28
|
+
else if (arg === '--roundtrip') {
|
|
29
|
+
options.roundtrip = true;
|
|
30
|
+
}
|
|
31
|
+
else if (arg === '--verbose' || arg === '-v') {
|
|
32
|
+
options.verbose = true;
|
|
33
|
+
}
|
|
34
|
+
else if (arg === '--help' || arg === '-h') {
|
|
35
|
+
printHelp();
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return options;
|
|
40
|
+
}
|
|
41
|
+
function printHelp() {
|
|
42
|
+
console.log(`
|
|
43
|
+
holo-test — Plugin test harness for Holo provider plugins
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
npx holo-test [options]
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
--plugin <name> Test only this plugin family (openai, claude, gemini, ollama)
|
|
50
|
+
--tag <tag> Filter fixtures by tag
|
|
51
|
+
--fixtures <dir> Path to fixtures directory (default: auto-discover)
|
|
52
|
+
--wire Run wire format tests only
|
|
53
|
+
--audit Run audit record tests only
|
|
54
|
+
--pipeline Run full pipeline tests only
|
|
55
|
+
--roundtrip Run SDK round-trip tests only
|
|
56
|
+
--verbose, -v Show diffs on failure
|
|
57
|
+
--help, -h Show this help
|
|
58
|
+
`);
|
|
59
|
+
}
|
|
60
|
+
async function main() {
|
|
61
|
+
const args = parseArgs(process.argv);
|
|
62
|
+
const originalCwd = process.env['INIT_CWD'] ?? process.cwd();
|
|
63
|
+
const fixtureDir = typeof args.fixtureDir === 'string'
|
|
64
|
+
? resolve(originalCwd, args.fixtureDir)
|
|
65
|
+
: resolve(originalCwd, 'plugins');
|
|
66
|
+
console.log(`holo-test — fixture dir: ${fixtureDir}`);
|
|
67
|
+
const success = await runTests({
|
|
68
|
+
fixtureDir,
|
|
69
|
+
plugin: typeof args.plugin === 'string' ? args.plugin : undefined,
|
|
70
|
+
tag: typeof args.tag === 'string' ? args.tag : undefined,
|
|
71
|
+
wire: args.wire === true,
|
|
72
|
+
audit: args.audit === true,
|
|
73
|
+
pipeline: args.pipeline === true,
|
|
74
|
+
roundtrip: args.roundtrip === true,
|
|
75
|
+
verbose: args.verbose === true,
|
|
76
|
+
});
|
|
77
|
+
process.exit(success ? 0 : 1);
|
|
78
|
+
}
|
|
79
|
+
main().catch(err => {
|
|
80
|
+
console.error(err);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEjD,SAAS,SAAS,CAAC,IAAc;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAqC,EAAE,CAAC;IAErD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,UAAU,IAAI,CAAC,GAAG,CAA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nB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/audit-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAKjD,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK9F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { loadPlugin } from '../services/plugin-loader.js';
|
|
2
|
+
import { testAudit } from '../testers/audit-tester.js';
|
|
3
|
+
import { assertTestResult } from '../helpers/vitest-helpers.js';
|
|
4
|
+
export async function runAuditContract(family, fixture) {
|
|
5
|
+
if (!fixture.expectedAudit)
|
|
6
|
+
return;
|
|
7
|
+
const plugin = await loadPlugin(family);
|
|
8
|
+
const result = await testAudit(plugin, fixture);
|
|
9
|
+
assertTestResult(result);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=audit-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-contract.js","sourceRoot":"","sources":["../../src/contracts/audit-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAwB;IAC3E,IAAI,CAAC,OAAO,CAAC,aAAa;QAAE,OAAO;IACnC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/pipeline-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAKjD,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { loadPlugin } from '../services/plugin-loader.js';
|
|
2
|
+
import { testPipeline } from '../testers/pipeline-tester.js';
|
|
3
|
+
import { assertTestResult } from '../helpers/vitest-helpers.js';
|
|
4
|
+
export async function runPipelineContract(family, fixture) {
|
|
5
|
+
const plugin = await loadPlugin(family);
|
|
6
|
+
const result = await testPipeline(plugin, fixture);
|
|
7
|
+
assertTestResult(result);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=pipeline-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-contract.js","sourceRoot":"","sources":["../../src/contracts/pipeline-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAc,EAAE,OAAwB;IAC9E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundtrip-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/roundtrip-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAI7D,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { testRoundTrip } from '../testers/roundtrip-tester.js';
|
|
2
|
+
import { assertTestResult } from '../helpers/vitest-helpers.js';
|
|
3
|
+
export async function runRoundTripContract(fixture, adapter) {
|
|
4
|
+
if (!fixture.sdkRequest || !fixture.expectedSdkResult)
|
|
5
|
+
return;
|
|
6
|
+
const result = await testRoundTrip(fixture, adapter);
|
|
7
|
+
assertTestResult(result);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=roundtrip-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundtrip-contract.js","sourceRoot":"","sources":["../../src/contracts/roundtrip-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAwB,EAAE,OAAmB;IACpF,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,iBAAiB;QAAE,OAAO;IAC9D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/wire-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAKjD,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { loadPlugin } from '../services/plugin-loader.js';
|
|
2
|
+
import { testWire } from '../testers/wire-tester.js';
|
|
3
|
+
import { assertTestResult } from '../helpers/vitest-helpers.js';
|
|
4
|
+
export async function runWireContract(family, fixture) {
|
|
5
|
+
const plugin = await loadPlugin(family);
|
|
6
|
+
const result = await testWire(plugin, fixture);
|
|
7
|
+
assertTestResult(result);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=wire-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-contract.js","sourceRoot":"","sources":["../../src/contracts/wire-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,OAAwB;IAC1E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AssertionError } from '../types.js';
|
|
2
|
+
export declare function assertEqual(field: string, actual: any, expected: any): AssertionError | null;
|
|
3
|
+
export declare function assertDeepEqual(field: string, actual: any, expected: any): AssertionError | null;
|
|
4
|
+
export declare function assertPartialMatch(field: string, actual: Record<string, any>, expected: Record<string, any>): AssertionError | null;
|
|
5
|
+
export declare function assertArrayEqual(field: string, actual: string[], expected: string[]): AssertionError[];
|
|
6
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/dsl/assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAEhD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,cAAc,GAAG,IAAI,CAG5F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,cAAc,GAAG,IAAI,CAYhG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,cAAc,GAAG,IAAI,CAMnI;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CA8BtG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { diffLines } from 'diff';
|
|
2
|
+
export function assertEqual(field, actual, expected) {
|
|
3
|
+
if (actual === expected)
|
|
4
|
+
return null;
|
|
5
|
+
return { field, expected, actual };
|
|
6
|
+
}
|
|
7
|
+
export function assertDeepEqual(field, actual, expected) {
|
|
8
|
+
const actualStr = JSON.stringify(actual, null, 2);
|
|
9
|
+
const expectedStr = JSON.stringify(expected, null, 2);
|
|
10
|
+
if (actualStr === expectedStr)
|
|
11
|
+
return null;
|
|
12
|
+
const changes = diffLines(expectedStr, actualStr);
|
|
13
|
+
const diffStr = changes.map(c => {
|
|
14
|
+
const prefix = c.added ? '+' : c.removed ? '-' : ' ';
|
|
15
|
+
return c.value.split('\n').filter(l => l).map(l => `${prefix} ${l}`).join('\n');
|
|
16
|
+
}).join('\n');
|
|
17
|
+
return { field, expected, actual, diff: diffStr };
|
|
18
|
+
}
|
|
19
|
+
export function assertPartialMatch(field, actual, expected) {
|
|
20
|
+
for (const [key, value] of Object.entries(expected)) {
|
|
21
|
+
const err = assertDeepEqual(`${field}.${key}`, actual?.[key], value);
|
|
22
|
+
if (err)
|
|
23
|
+
return err;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
export function assertArrayEqual(field, actual, expected) {
|
|
28
|
+
const errors = [];
|
|
29
|
+
if (actual.length !== expected.length) {
|
|
30
|
+
errors.push({
|
|
31
|
+
field: `${field}.length`,
|
|
32
|
+
expected: expected.length,
|
|
33
|
+
actual: actual.length,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const len = Math.min(actual.length, expected.length);
|
|
37
|
+
for (let i = 0; i < len; i++) {
|
|
38
|
+
if (actual[i] !== expected[i]) {
|
|
39
|
+
const changes = diffLines(expected[i], actual[i]);
|
|
40
|
+
const diffStr = changes.map(c => {
|
|
41
|
+
const prefix = c.added ? '+' : c.removed ? '-' : ' ';
|
|
42
|
+
return c.value.split('\n').filter(l => l).map(l => `${prefix} ${l}`).join('\n');
|
|
43
|
+
}).join('\n');
|
|
44
|
+
errors.push({
|
|
45
|
+
field: `${field}[${i}]`,
|
|
46
|
+
expected: expected[i],
|
|
47
|
+
actual: actual[i],
|
|
48
|
+
diff: diffStr,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return errors;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=assertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/dsl/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAG/B,MA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CAAC;gBACrD,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,MAAM,CAAC,IAAI,CAAC;gBACR,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;gBACvB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACrB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;gBACjB,IAAI,EAAE,OAAO;aAChB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FixtureScenario } from '../types.js';
|
|
2
|
+
declare class SuiteBuilder {
|
|
3
|
+
private _plugin?;
|
|
4
|
+
private _protocol?;
|
|
5
|
+
private _streaming?;
|
|
6
|
+
private _fixtureDir?;
|
|
7
|
+
private _fixtures?;
|
|
8
|
+
private _categories;
|
|
9
|
+
private _verbose;
|
|
10
|
+
forPlugin(plugin: string): SuiteBuilder;
|
|
11
|
+
protocol(protocol: string): SuiteBuilder;
|
|
12
|
+
streaming(streaming?: boolean): SuiteBuilder;
|
|
13
|
+
fixtureDir(dir: string): SuiteBuilder;
|
|
14
|
+
withFixtures(fixtures: FixtureScenario[]): SuiteBuilder;
|
|
15
|
+
wire(): SuiteBuilder;
|
|
16
|
+
audit(): SuiteBuilder;
|
|
17
|
+
pipeline(): SuiteBuilder;
|
|
18
|
+
roundTrip(): SuiteBuilder;
|
|
19
|
+
allFixtures(): SuiteBuilder;
|
|
20
|
+
verbose(verbose?: boolean): SuiteBuilder;
|
|
21
|
+
run(): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare function suite(): SuiteBuilder;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=suite-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-builder.d.ts","sourceRoot":"","sources":["../../src/dsl/suite-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,eAAe,EAAa,MAAM,aAAa,CAAC;AAE7D,cAAM,YAAY;IACd,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAU;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAoB;IACtC,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,QAAQ,CAAS;IAEzB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAKvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAKxC,SAAS,CAAC,SAAS,UAAO,GAAG,YAAY;IAKzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAKrC,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,YAAY;IAKvD,IAAI,IAAI,YAAY;IAKpB,KAAK,IAAI,YAAY;IAKrB,QAAQ,IAAI,YAAY;IAKxB,SAAS,IAAI,YAAY;IAKzB,WAAW,IAAI,YAAY;IAI3B,OAAO,CAAC,OAAO,UAAO,GAAG,YAAY;IAK/B,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAsChC;AAED,wBAAgB,KAAK,IAAI,YAAY,CAEpC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { loadFixtures } from '../fixtures/fixture-loader.js';
|
|
2
|
+
import { loadPlugin } from '../services/plugin-loader.js';
|
|
3
|
+
import { testWire } from '../testers/wire-tester.js';
|
|
4
|
+
import { testAudit } from '../testers/audit-tester.js';
|
|
5
|
+
import { testPipeline } from '../testers/pipeline-tester.js';
|
|
6
|
+
import { testRoundTrip } from '../testers/roundtrip-tester.js';
|
|
7
|
+
import { reportResults } from '../runner/test-reporter.js';
|
|
8
|
+
class SuiteBuilder {
|
|
9
|
+
_plugin;
|
|
10
|
+
_protocol;
|
|
11
|
+
_streaming;
|
|
12
|
+
_fixtureDir;
|
|
13
|
+
_fixtures;
|
|
14
|
+
_categories = new Set();
|
|
15
|
+
_verbose = false;
|
|
16
|
+
forPlugin(plugin) {
|
|
17
|
+
this._plugin = plugin;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
protocol(protocol) {
|
|
21
|
+
this._protocol = protocol;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
streaming(streaming = true) {
|
|
25
|
+
this._streaming = streaming;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
fixtureDir(dir) {
|
|
29
|
+
this._fixtureDir = dir;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
withFixtures(fixtures) {
|
|
33
|
+
this._fixtures = fixtures;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
wire() {
|
|
37
|
+
this._categories.add('wire');
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
audit() {
|
|
41
|
+
this._categories.add('audit');
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
pipeline() {
|
|
45
|
+
this._categories.add('pipeline');
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
roundTrip() {
|
|
49
|
+
this._categories.add('roundtrip');
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
allFixtures() {
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
verbose(verbose = true) {
|
|
56
|
+
this._verbose = verbose;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
async run() {
|
|
60
|
+
let fixtures = this._fixtures;
|
|
61
|
+
if (!fixtures) {
|
|
62
|
+
const dir = this._fixtureDir || process.cwd();
|
|
63
|
+
fixtures = await loadFixtures(dir, { plugin: this._plugin });
|
|
64
|
+
}
|
|
65
|
+
if (this._protocol) {
|
|
66
|
+
fixtures = fixtures.filter(f => f.protocol === this._protocol);
|
|
67
|
+
}
|
|
68
|
+
if (this._streaming !== undefined) {
|
|
69
|
+
fixtures = fixtures.filter(f => f.streaming === this._streaming);
|
|
70
|
+
}
|
|
71
|
+
const runAll = this._categories.size === 0;
|
|
72
|
+
const results = [];
|
|
73
|
+
for (const fixture of fixtures) {
|
|
74
|
+
const pluginImpl = await loadPlugin(fixture.plugin);
|
|
75
|
+
if (runAll || this._categories.has('wire')) {
|
|
76
|
+
results.push(await testWire(pluginImpl, fixture));
|
|
77
|
+
}
|
|
78
|
+
if (runAll || this._categories.has('audit')) {
|
|
79
|
+
if (fixture.expectedAudit) {
|
|
80
|
+
results.push(await testAudit(pluginImpl, fixture));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (runAll || this._categories.has('pipeline')) {
|
|
84
|
+
results.push(await testPipeline(pluginImpl, fixture));
|
|
85
|
+
}
|
|
86
|
+
if (this._categories.has('roundtrip') && fixture.sdkAdapter && fixture.sdkRequest) {
|
|
87
|
+
results.push(await testRoundTrip(fixture, fixture.sdkAdapter));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return reportResults(results, this._verbose);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export function suite() {
|
|
94
|
+
return new SuiteBuilder();
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=suite-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-builder.js","sourceRoot":"","sources":["../../src/dsl/suite-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,QAA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I,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1C,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;gBACvD,CAAC;YACL,CAAC;YACD,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7C,OAAO,CAAC,IAAI,CAAC,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBAChF,OAAO,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;YACnE,CAAC;QACL,CAAC;QAED,OAAO,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACJ;AAED,MAAM,UAAU,KAAK;IACjB,OAAO,IAAI,YAAY,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HoloWorkerRequest } from '@holokai/holo-types/worker';
|
|
2
|
+
import type { FixtureScenario } from '../types.js';
|
|
3
|
+
export declare function createTestWorkerRequest(fixture: FixtureScenario): HoloWorkerRequest;
|
|
4
|
+
export declare function createTestEnvelope(fixture: FixtureScenario, request: HoloWorkerRequest): import("@holokai/holo-types/worker").WorkerResponseEnvelope;
|
|
5
|
+
//# sourceMappingURL=worker-request-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-request-factory.d.ts","sourceRoot":"","sources":["../../src/factories/worker-request-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAGlE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAGjD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAYnF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,+DAEtF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createWorkerRequest, createResponseEnvelope } from '@holokai/holo-sdk/provider';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
export function createTestWorkerRequest(fixture) {
|
|
4
|
+
const protocol = { id: fixture.protocolId ?? uuidv4(), name: fixture.protocol, capability: 'chat' };
|
|
5
|
+
return createWorkerRequest({
|
|
6
|
+
provider: { id: fixture.providerId ?? uuidv4(), name: fixture.plugin },
|
|
7
|
+
protocol,
|
|
8
|
+
payload: fixture.payload ?? {},
|
|
9
|
+
sourceId: fixture.sourceId ?? uuidv4(),
|
|
10
|
+
requestId: fixture.requestId ?? uuidv4(),
|
|
11
|
+
organizationId: fixture.organizationId ?? 'test-org',
|
|
12
|
+
isStreaming: fixture.streaming,
|
|
13
|
+
httpRequestDetails: { path: '/test', method: 'POST' },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function createTestEnvelope(fixture, request) {
|
|
17
|
+
return createResponseEnvelope(request, fixture.expectedAudit?.access_model ?? 'unknown');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=worker-request-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-request-factory.js","sourceRoot":"","sources":["../../src/factories/worker-request-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,mBAAmB,EAAE,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAEvF,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAElC,MAAM,UAAU,uBAAuB,CAAC,OAAwB;IAC5D,MAAM,QAAQ,GAAqB,EAAC,EAAE,EAAE,OAAO,CAAC,UAAU,IAAI,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAC,CAAC;IACpH,OAAO,mBAAmB,CAAC;QACvB,QAAQ,EAAE,EAAC,EAAE,EAAE,OAAO,CAAC,UAAU,IAAI,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAQ;QAC3E,QAAQ;QACR,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;QAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM,EAAE;QACtC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,MAAM,EAAE;QACxC,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,UAAU;QACpD,WAAW,EAAE,OAAO,CAAC,SAAS;QAC9B,kBAAkB,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC;KACtD,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAwB,EAAE,OAA0B;IACnF,OAAO,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,YAAY,IAAI,SAAS,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture-loader.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixture-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAEjD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;IACzD,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAqB7B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { glob } from 'node:fs/promises';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
export async function loadFixtures(baseDir, filter) {
|
|
4
|
+
const pattern = `${baseDir}/**/*.fixture.{ts,js}`;
|
|
5
|
+
const files = [];
|
|
6
|
+
for await (const file of glob(pattern)) {
|
|
7
|
+
files.push(file);
|
|
8
|
+
}
|
|
9
|
+
const fixtures = [];
|
|
10
|
+
for (const file of files.sort()) {
|
|
11
|
+
const mod = await import(pathToFileURL(file).href);
|
|
12
|
+
const scenario = mod.default ?? mod.fixture;
|
|
13
|
+
if (!scenario)
|
|
14
|
+
continue;
|
|
15
|
+
if (filter?.plugin && scenario.plugin !== filter.plugin)
|
|
16
|
+
continue;
|
|
17
|
+
if (filter?.tag && !scenario.tags?.includes(filter.tag))
|
|
18
|
+
continue;
|
|
19
|
+
fixtures.push(scenario);
|
|
20
|
+
}
|
|
21
|
+
return fixtures;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=fixture-loader.js.map
|