// What the generated tenant-isolation suite (test/isolation.test.ts) needs of this module, from this // folder: one fixture per tenant-scoped procedure, each called as a member of one organization with // another's slugs, which the resolver must refuse before the Inventory service is reached. // // The module keeps no row of its own, so it seeds nothing: what a fixture names is the other tenant's // project, and an id is any well-formed one (the service is never asked). The suite reads this file by // its place whether or not the module is on, and checks only the procedures the app registers, so // while the module is off (the template's default) it brings no fixture; `procedures.test.ts` runs the // same fixtures against the module on its own, on or off. import type { TransportCaller } from "@conusai-kit/core" import type { IsolationFixture, IsolationTenant } from "@conusai-kit/testing" import { businessModulesOn } from "../../index.js" const SOMEWHERE = "00000000-0000-4000-8000-000000000001" const inProjectOf = (t: IsolationTenant) => ({ org: t.orgSlug, workspace: t.workspaceSlug, project: t.projectSlug }) export const inventoryIsolationFixtures: Record = { "inventory.item.list": { input: (t) => inProjectOf(t) }, "inventory.item.create": { input: (t) => ({ ...inProjectOf(t), sku: "INTRUDER-1", name: "Intruder", unit: "pcs" }) }, "inventory.item.availability": { input: (t) => ({ ...inProjectOf(t), itemId: SOMEWHERE }) }, "inventory.reservation.list": { input: (t) => inProjectOf(t) }, "inventory.stock.reserve": { input: (t) => ({ ...inProjectOf(t), itemId: SOMEWHERE, locationId: SOMEWHERE, quantity: 1, requestId: SOMEWHERE }), }, "inventory.stock.release": { input: (t) => ({ ...inProjectOf(t), reservationId: SOMEWHERE, requestId: SOMEWHERE }) }, } /** The shape the suite reads (`modules/notes/__tests__/isolation.ts` names it), so no other module is imported. */ export const isolation: { seed( call: TransportCaller, inProject: { org: string; workspace: string; project: string }, ): Promise> fixtures: Record } = { seed: async () => ({}), fixtures: businessModulesOn.includes("inventory") ? inventoryIsolationFixtures : {}, }