@@ -0,0 +1,25 @@
|
||||
// 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())
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
// Why the account module's procedures need no tenant-isolation fixture, for the generated suite's
|
||||
// `exempt` list (test/isolation.test.ts).
|
||||
|
||||
export { accountIsolationExempt } from "@conusai-kit/account/testing"
|
||||
@@ -0,0 +1,35 @@
|
||||
// The app wired the way apps/web and apps/worker wire the account module, through
|
||||
// `@conusai-kit/account/testing`: this app's modules, and the recording platforms of the opt-in ones.
|
||||
|
||||
import { type AccountAppOptions, makeAccountApp, withoutModules } from "@conusai-kit/account/testing"
|
||||
import type { ModuleManifest } from "@conusai-kit/core"
|
||||
import { GUIDES_PLATFORM, GUIDES_REGISTRY } from "@conusai-kit/guides" // kit:guides
|
||||
import { recordingGuidesPlatform } from "@conusai-kit/guides/testing" // kit:guides
|
||||
import { SUPPORT_PLATFORM } from "@conusai-kit/support" // kit:support
|
||||
import { recordingSupportPlatform } from "@conusai-kit/support/testing" // kit:support
|
||||
import { appModules } from "../../index.js"
|
||||
|
||||
export * from "@conusai-kit/account/testing"
|
||||
|
||||
/** The app's modules without `removed`, as `kit template:prune --without` leaves them. */
|
||||
export const modulesWithout = (...removed: string[]): ModuleManifest[] => withoutModules(appModules, ...removed)
|
||||
|
||||
export function makeApp(options: Partial<AccountAppOptions> = {}) {
|
||||
const guides = recordingGuidesPlatform() // kit:guides
|
||||
const support = recordingSupportPlatform() // kit:support
|
||||
const app = makeAccountApp({
|
||||
...options,
|
||||
modules: options.modules ?? appModules,
|
||||
bind(root, registry) {
|
||||
root.value(GUIDES_PLATFORM, guides) // kit:guides
|
||||
root.value(GUIDES_REGISTRY, registry) // kit:guides
|
||||
root.value(SUPPORT_PLATFORM, support) // kit:support
|
||||
options.bind?.(root, registry)
|
||||
},
|
||||
})
|
||||
return {
|
||||
...app,
|
||||
guides, // kit:guides
|
||||
support, // kit:support
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user