Spaces:
Sleeping
Sleeping
Download apps/server/src/kernel/app-key.unit.test.ts from phucsd/Oloka-Video-Dev: direct link, hf CLI and curl.
- Browser
- Download file 557 Bytes
-
https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/kernel/app-key.unit.test.ts
- Command line
-
hf download hf://spaces/phucsd/Oloka-Video-Dev/apps/server/src/kernel/app-key.unit.test.ts
-
curl -L -o app-key.unit.test.ts https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/kernel/app-key.unit.test.ts
557 Bytes
| import { describe, expect, it } from "vitest"; | |
| import { decodeApplicationKey } from "./app-key.js"; | |
| describe("decodeApplicationKey", () => { | |
| it("accepts only an unpadded base64url encoding of exactly 32 bytes", () => { | |
| const encoded = Buffer.alloc(32, 7).toString("base64url"); | |
| expect(decodeApplicationKey(encoded)).toEqual(Buffer.alloc(32, 7)); | |
| expect(() => decodeApplicationKey(`${encoded}=`)).toThrow(/base64url/i); | |
| expect(() => | |
| decodeApplicationKey(Buffer.alloc(31).toString("base64url")), | |
| ).toThrow(/32 bytes/i); | |
| }); | |
| }); | |