UNPKG

@accounter/server

Version:
53 lines (52 loc) 1.99 kB
/** * Expense Scenario B: Foreign Currency (USD) Invoice Expense * * This scenario represents an expense paid in foreign currency (USD) with an invoice. * It demonstrates foreign currency handling and exchange rate conversion in ledger generation. * * Flow: * 1. Admin business purchases from US Vendor LLC * 2. Transaction recorded: -200 USD (negative = expense/outflow) * 3. Invoice document provided in USD * 4. Expected ledger: debit expense category (in ILS), credit bank account (in ILS) * - Exchange rate: 3.5 ILS per USD (mocked/deterministic) * - 200 USD × 3.5 = 700 ILS total * * Prerequisites: * - Admin business entity exists (from seed) * - General expense tax category exists (from seed) * - Exchange rate mocked: USD→ILS at 3.5 */ import type { Fixture } from '../../helpers/fixture-types'; /** * Expense Scenario B: USD Invoice Expense * * @description * A US supplier provides a service, admin pays 200 USD, receives an invoice. * This tests foreign currency conversion with a deterministic exchange rate. * * @example * ```typescript * import { expenseScenarioB } from './fixtures/expenses/expense-scenario-b'; * import { insertFixture } from './helpers/fixture-loader'; * import { mockExchangeRate } from './helpers/exchange-mock'; * import { Currency } from '../../../shared/enums.js'; * * await withTestTransaction(pool, async (client) => { * await seedAdminCore(client); // Ensure admin context exists * const idMap = await insertFixture(client, expenseScenarioB); * * // Create context with mocked exchange rate * const context = createLedgerTestContext({ * pool, * adminContext, * mockExchangeRates: mockExchangeRate(Currency.Usd, Currency.Ils, 3.5), * }); * * // Now test ledger generation with foreign currency * const chargeId = idMap.get('charge-consulting-services'); * // ... trigger ledger generation and assert * }); * ``` */ export declare const expenseScenarioB: Fixture;