@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
// The account module's public API: what a page, another module and the OpenAPI document may import.
|
||||
|
||||
export * from "@conusai-kit/account/contract"
|
||||
@@ -0,0 +1,8 @@
|
||||
// This app's account module is `@conusai-kit/account`: the person's own account, export my data and
|
||||
// delete my account, with the resumable deletion ledger, and its migrations, which the migrate job
|
||||
// reads from the package. This folder keeps what belongs to the app: any extension of the module. To
|
||||
// extend it, change this file: `{ ...accountModule, ... }` under the same id adds a procedure, a job or
|
||||
// a share of an account, and the rest of the app reads it from here. A module's own share of an account
|
||||
// does not need this: contribute it to `accountData`.
|
||||
|
||||
export * from "@conusai-kit/account"
|
||||
@@ -0,0 +1,3 @@
|
||||
// The account module's components: the panels and label builders of the app's account page.
|
||||
|
||||
export * from "@conusai-kit/account/ui"
|
||||
Reference in New Issue
Block a user