feat: complete remaining Go backend modules
This commit is contained in:
1 parent
cea2751dc5
commit
aef5a97165
145 files changed
+18376
-199
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("assets HTTP v1 compatibility contract", () => {
|
||||
it("freezes route, limit, safe-error, and binary-cache semantics", async () => {
|
||||
const contract = JSON.parse(await readFile(new URL("../contracts/assets/http-v1.json", import.meta.url), "utf8"));
|
||||
expect(contract.version).toBe(1);
|
||||
expect(contract.limits).toEqual({ jsonBytes: 1_048_576, uploadBytes: 20_971_520, remoteBytes: 20_971_520 });
|
||||
expect(contract.routes.map((route: { path: string }) => route.path)).toEqual([
|
||||
"/api/assets", "/api/assets/upload", "/api/assets/{id}", "/api/assets/{id}/download",
|
||||
"/api/v1/assets", "/api/v1/assets/{id}", "/api/v1/assets/{id}/download",
|
||||
"/uploads/{path...}", "/generated-results/{path...}"
|
||||
]);
|
||||
expect(contract.errors.internal.body).toEqual({ error: "Internal server error." });
|
||||
expect(contract.methods).toEqual({ headExecutesGet: true, optionsStatus: 204, unsupportedStatus: 405, unsupportedBody: "empty" });
|
||||
expect(contract.binary).toEqual({
|
||||
downloadCacheControl: "private, no-store",
|
||||
servedCacheControl: "public, max-age=31536000, immutable"
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user