1import { DurableStorageUnsupportedError } from "./device-capabilities.ts";2// Package contract tests.3import { assert } from "./test-assert.ts";45const test = (globalThis as unknown as {6 Deno: { test(name: string, body: () => void | Promise<void>): void };7}).Deno.test;89test("unsupported durable storage names missing capabilities and the stable-origin action", () => {10 const error = new DurableStorageUnsupportedError({11 secureContext: false,12 opfs: false,13 sharedWorker: false,14 webLocks: false,15 messageChannel: false,16 durableDriverSupported: false,17 webAuthn: false,18 prf: "unavailable",19 displayMode: "browser",20 });21 assert(error.name === "DurableStorageUnsupportedError", "durability error needs a stable name");22 for (23 const capability of [24 "secureContext",25 "opfs",26 "sharedWorker",27 "webLocks",28 "messageChannel",29 ]30 ) {31 assert(error.message.includes(capability), `durability error omitted ${capability}`);32 }33 assert(34 error.message.includes("stable HTTPS device URL"),35 "durability error omitted the stable-origin remediation",36 );37});