test(router): run the parity differential on Deno, Bun and workerd
The matcher comparison does not depend on the runtime, so it should run on every
runtime core supports. Only the Node suite ran it before.
The comparison and the app.fetch fixtures move into differential.ts and
app-fixture.ts, which use neither vitest nor a file API. Each runtime passes in
a loader for the frozen JSON. The vitest files use the same modules, plus a
Node check that the neutral runners report no mismatch, so the two paths cannot
drift.
- Deno and Bun: test/{deno,bun}/router-parity.test.ts run all 1158 frozen
matcher cases (hand-picked, owner, generated v1 and v2, WS) through the oracle
and the live router, plus the 55 app.fetch cases.
- workerd: test/edge/parity-worker.ts bundles the frozen JSON and runs the
same checks; test/edge/run.ts adds the phase after its existing assertions.
The Node-socket, WS-upgrade, boot and mesh captures stay Node-only: they need
http.request, the ws client, or a mesh peer on a port.
Refs #109
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
11 files changed
+553
-247
No files matched your search
@@ -0,0 +1,22 @@
|
||||
// The frozen router-parity differential under the real Bun runtime: every matcher case (hand-picked,
|
||||
// owner, generated v1/v2, WS) through the oracle and the live router, and the app.fetch cases, all
|
||||
// against the same frozen files the Node suite uses. See test/router-parity/README.md.
|
||||
//
|
||||
// Run with: npm run test:bun
|
||||
import 'reflect-metadata';
|
||||
import { test, expect } from 'bun:test';
|
||||
import { runDifferential } from '../router-parity/differential.ts';
|
||||
import { runAppDifferential } from '../router-parity/app-fixture.ts';
|
||||
|
||||
const load = (name: string) => Bun.file(new URL(`../router-parity/frozen/${name}.json`, import.meta.url)).json();
|
||||
|
||||
test('router parity on Bun: frozen matcher differential, oracle and live', async () => {
|
||||
const report = await runDifferential(load);
|
||||
expect(report.mismatches).toEqual([]);
|
||||
expect(report.sets.length).toBe(5);
|
||||
});
|
||||
|
||||
test('router parity on Bun: app.fetch cases', async () => {
|
||||
const report = await runAppDifferential(load);
|
||||
expect(report.mismatches).toEqual([]);
|
||||
});
|
||||
Reference in new issue
Block a user