@accounter/server
Version:
The test suite is split into three Vitest projects for efficiency and isolation:
26 lines (25 loc) • 974 B
TypeScript
import type { Injector } from 'graphql-modules';
import type { Pool } from 'pg';
import type { AdminContext } from '../plugins/admin-context-plugin.js';
import type { Currency } from '../shared/enums.js';
export type ModuleContextLike = {
injector: Injector;
adminContext: AdminContext;
moduleId: string;
env?: unknown;
currentUser?: unknown;
};
export type ExchangeRateMockFn = (baseCurrency: Currency, quoteCurrency: Currency, date: Date) => Promise<number>;
export declare function createLedgerTestContext(options: {
pool: Pool;
adminContext: AdminContext;
moduleId?: string;
env?: unknown;
currentUser?: unknown;
/**
* Optional mock function to override ExchangeProvider.getExchangeRates.
* Use this to fix exchange rates for deterministic tests.
* @see createMockExchangeRates, mockExchangeRate from __tests__/helpers/exchange-mock.ts
*/
mockExchangeRates?: ExchangeRateMockFn;
}): ModuleContextLike;