Heimdall/tests/verse-witness.test.ts
Meta Vens 1c38d12050 Add Joystick as a confidential, rotating managed-connection provider
Joystick joins the catalog (Basic client auth, rotatesRefreshTokens), resolves
identity by channel id, and is a streampixels managed-connection provider only:
it is not an identity provider for the profile (ruling signin-waits-for-public-bot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:13:40 +02:00

59 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
buildHeimdallProviderAdvertisement,
heimdallWitnessDocuments,
heimdallWitnessSchemaIds,
} from "../src/verse-witness.js";
describe("Heimdall Verse witness advertisement", () => {
it("advertises the Odin/Eve provider surface and redacted witness documents", () => {
const advertisement = buildHeimdallProviderAdvertisement({
updatedAt: "2026-06-03T12:00:00.000Z",
});
expect(advertisement).toMatchObject({
schemaVersion: "gamecult.eve.provider_advertisement.v1",
providerId: "heimdall",
verseId: "gamecult",
status: "read_only_witness_planned",
updatedAt: "2026-06-03T12:00:00.000Z",
controlSurface: {
controls: {
mode: "read-only",
writes: false,
},
},
});
expect(advertisement.providers.map((provider) => provider.key)).toEqual([
"discord",
"patreon",
"github",
"twitch",
"youtube",
"spotify",
"joystick",
]);
expect(advertisement.appProfiles.map((profile) => profile.slug)).toEqual([
"repixelizer",
"streampixels",
"bifrost",
"ghostlight",
]);
expect(advertisement.documents.map((document) => document.schemaId)).toEqual([...heimdallWitnessSchemaIds]);
});
it("keeps token custody fields forbidden in witness descriptors", () => {
expect(heimdallWitnessDocuments).toEqual(
expect.arrayContaining([
expect.objectContaining({
schemaId: "heimdall.linked_identity.v0",
forbiddenFields: expect.arrayContaining(["accessTokenEncrypted", "refreshTokenEncrypted"]),
}),
expect.objectContaining({
schemaId: "heimdall.managed_credential_projection.v0",
forbiddenFields: expect.arrayContaining(["accessToken", "refreshToken"]),
}),
])
);
});
});