Files
cfw-autumn/server/tests/utils/fixtures/db/rollovers.ts
John Yeo cb05d169a2 wip
2026-01-23 17:13:19 +00:00

36 lines
979 B
TypeScript

import type { EntityRolloverBalance, Rollover } from "@autumn/shared";
/**
* Create a rollover fixture
*/
const create = ({
id,
cusEntId,
balance,
usage = 0,
expiresAt = null,
entities = {},
}: {
id?: string;
cusEntId: string;
balance: number;
usage?: number;
expiresAt?: number | null;
entities?: Record<string, EntityRolloverBalance>;
}): Rollover => ({
id: id ?? `rollover_${crypto.randomUUID().slice(0, 8)}`,
cus_ent_id: cusEntId,
balance,
usage,
expires_at: expiresAt,
entities,
});
// ═══════════════════════════════════════════════════════════════════
// EXPORT
// ═══════════════════════════════════════════════════════════════════
export const rollovers = {
create,
} as const;