Files
tech-log-frontend/tests/unit/web-push-store-port-compatibility.test.ts

29 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { IndexedDbRepositoryPort } from "../../src/application/ports/browser-file-storage/indexeddb-port.ts";
import type {
PushControlRepository,
} from "../../src/adapters/web-push/push-association-fence-store.ts";
import type { PushControlV1 } from "../../src/contracts/web-push.ts";
/**
* The Web Push fence store declares its own narrow durable-store port so the
* Web Push and browser file/storage capabilities stay independently removable.
*
* This suite is what keeps that decoupling honest: it asserts at type level
* that the generic IndexedDB repository still satisfies the narrow port, so the
* composition root can join the two without an adapter shim. It lives in the
* browser-data import graph on purpose, so the storage removal harness drops it
* along with the runtime it checks.
*/
describe("push control store port compatibility", () => {
it("is satisfied by the generic IndexedDB repository", () => {
type GenericRepository = IndexedDbRepositoryPort<PushControlV1, never>;
const satisfiesNarrowPort = (
repository: GenericRepository,
): PushControlRepository => repository;
expect(typeof satisfiesNarrowPort).toBe("function");
});
});