@@ -0,0 +1,57 @@
|
||||
import type { IsolationFixture } from "@conusai-kit/testing"
|
||||
import { businessModulesOn } from "../../index.js"
|
||||
|
||||
const id = "00000000-0000-4000-8000-000000000001"
|
||||
const acc = `acc_${id}`
|
||||
const txn = `txn_${id}`
|
||||
const fixtures: Record<string, IsolationFixture> = {}
|
||||
for (const name of ["accounts.list", "balances.list", "transactions.list", "verify"])
|
||||
fixtures[`ledger.${name}`] = { input: (t) => ({ org: t.orgSlug }) }
|
||||
for (const name of ["accounts.get", "entries.list"])
|
||||
fixtures[`ledger.${name}`] = { input: (t) => ({ org: t.orgSlug, accountId: acc }) }
|
||||
fixtures["ledger.transactions.get"] = { input: (t) => ({ org: t.orgSlug, transactionId: txn }) }
|
||||
fixtures["ledger.accounts.create"] = {
|
||||
input: (t) => ({
|
||||
org: t.orgSlug,
|
||||
requestId: id,
|
||||
code: "SYNTHETIC",
|
||||
name: "Operational",
|
||||
currency: "EUR",
|
||||
type: "asset",
|
||||
normalBalance: "debit",
|
||||
allowNegative: false,
|
||||
}),
|
||||
}
|
||||
fixtures["ledger.accounts.update"] = {
|
||||
input: (t) => ({
|
||||
org: t.orgSlug,
|
||||
accountId: acc,
|
||||
requestId: id,
|
||||
expectedVersion: "1",
|
||||
name: "Operational",
|
||||
status: "archived",
|
||||
allowNegative: false,
|
||||
}),
|
||||
}
|
||||
fixtures["ledger.transactions.record"] = {
|
||||
input: (t) => ({
|
||||
org: t.orgSlug,
|
||||
requestId: id,
|
||||
confirmed: true,
|
||||
terms: {
|
||||
effectiveAt: "2026-11-03T00:00:00Z",
|
||||
description: "Synthetic",
|
||||
status: "pending",
|
||||
entries: [
|
||||
{ accountId: acc, direction: "debit", amountMinor: "1" },
|
||||
{ accountId: acc, direction: "credit", amountMinor: "1" },
|
||||
],
|
||||
},
|
||||
}),
|
||||
}
|
||||
for (const name of ["post", "void", "reverse"])
|
||||
fixtures[`ledger.transactions.${name}`] = {
|
||||
input: (t) => ({ org: t.orgSlug, transactionId: txn, expectedVersion: "1", requestId: id, confirmed: true }),
|
||||
}
|
||||
export const ledgerIsolationFixtures = fixtures
|
||||
export const isolation = { seed: async () => ({}), fixtures: businessModulesOn.includes("ledger") ? fixtures : {} }
|
||||
Reference in New Issue
Block a user