1
0

test: enforce simulation and render budgets

This commit is contained in:
2026-08-11 22:02:29 -07:00
parent 19f022f71a
commit 655c383061
9 changed files with 822 additions and 6 deletions
+4 -2
View File
@@ -28,7 +28,8 @@ const PROVIDER_CREDENTIAL: ScreenShareCredential = {
sessionId: "opaque-session", participantId: "opaque-participant", role: "presenter", grantToken: "opaque-grant-token-value",
};
const iceRequest = (credential: ScreenShareCredential = PROVIDER_CREDENTIAL, binding: ScreenShareBinding = BINDING) => ({
type: "ice-config-request", protocolVersion: 1, requestId: "ice-request-1", binding, credential,
type: "ice-config-request", protocolVersion: 1, requestId: "ice-request-1",
binding: { ...binding }, credential: { ...credential },
} as const);
const request = iceRequest();
const rateKeys = (subject = "auth-subject", trustedIp = "203.0.113.8") => ({ subject, trustedIp });
@@ -221,7 +222,8 @@ describe("authenticated ICE route", () => {
const missing = { ...iceRequest(presenter) } as Record<string, unknown>;
delete missing.credential;
assert.equal((await app.inject({ method: "POST", url: "/api/v1/media/ice", headers: bearer("presenter"), payload: missing })).statusCode, 400);
assert.equal((await app.inject({ method: "POST", url: "/api/v1/media/ice", headers: bearer("thief"), payload: iceRequest(presenter) })).statusCode, 401);
const stolen = await app.inject({ method: "POST", url: "/api/v1/media/ice", headers: bearer("thief"), payload: iceRequest(presenter) });
assert.equal(stolen.statusCode, 401, stolen.body);
assert.equal((await app.inject({ method: "POST", url: "/api/v1/media/ice", headers: bearer("presenter"), payload: iceRequest(presenter, SECOND_BINDING) })).statusCode, 401);
const joined = await app.inject({ method: "POST", url: "/api/v1/media/join", headers: bearer("viewer"), payload: {