Files
template-app/modules/account/__tests__/composition.test.ts
T
2026-11-14 09:56:45 +00:00

26 lines
1.1 KiB
TypeScript

// The module the app runs is the kit's: this file proves the re-export composes in this app, with
// every module it installed. The module's own tests are in `@conusai-kit/account`.
import { accountDataOf } from "@conusai-kit/tenancy"
import { describe, expect, it } from "vitest"
import { appModules } from "../../index.js"
import { accountModule, type DeletionView } from "../index.js"
import { makeApp } from "./harness.js"
describe("the account module of this app", () => {
it("is the kit's module, in the module list", () => {
expect(appModules).toContain(accountModule)
})
it("deletes an account over every share this app installed", async () => {
const app = makeApp()
const ada = await app.signUp("ada@example.test")
const erasing = accountDataOf(app.registry).filter((share) => share.erase)
const view = (await ada.call().callByName("account.deletion.request", { confirm: ada.email })) as DeletionView
expect(view).toMatchObject({ state: "completed", pending: [] })
expect([...view.erased].sort()).toEqual(erasing.map((share) => share.key).sort())
})
})