Make the edge protocol contract test pass on its own
tests/edge_protocol.test.ts validates schemas carrying format: "uuid" and format: "uri" but registered neither. TypeBox treats an unregistered format as a failure, not a pass, so every start_print in that file was rejected - and the file still went green, because some other test in the same run imported Elysia first and registered the formats globally. Run alone it failed. A contract test that depends on which files ran before it is the worst way for one to behave. It now imports src/validation/formats, which exists for exactly this and gains a "uri" validator: anything the platform parses as an absolute URL. Lenient on purpose - the only user is a presigned object-store GET that this backend mints itself, so a stricter pattern would have to anticipate whatever query parameters a signer adds, and rejecting a URL R2 would have honoured costs a print for no security.
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { Value } from "@sinclair/typebox/value";
|
||||
import { EdgeClientMessageSchema, EdgeServerMessageSchema } from "@continuum/ts-types";
|
||||
// Registers `uuid` and `uri`. Not optional: TypeBox treats an unregistered
|
||||
// format as a failure, so without this every `start_print` in this file is
|
||||
// rejected for its job_id and url. This file used to rely on another test
|
||||
// file importing Elysia first, which made it pass in a full run and fail on
|
||||
// its own.
|
||||
import "../src/validation/formats";
|
||||
|
||||
import currentCapture from "./fixtures/gateway_frames.json";
|
||||
import legacyCapture from "./fixtures/gateway_frames_legacy_nulls.json";
|
||||
|
||||
Reference in New Issue
Block a user