Variable: mockInvoice
@arolariu/website / data/mocks/invoice / mockInvoice
Variable: mockInvoice
constmockInvoice:Invoice
Defined in: data/mocks/invoice.ts:1039
Pre-built mock invoice with predictable values for quick testing.
Remarks
Deterministic Data: Unlike generateRandomInvoice, this mock has fixed, predictable values suitable for snapshot tests and assertions.
Fixed Values:
id: "invoice-1"name: "Test Invoice"category: InvoiceCategory.GROCERYuserIdentifier: "user-123"
Random Values: Other properties (description, dates, payment info) are randomly generated at module load time. They are consistent within a single test run.
Use Cases:
- Snapshot tests requiring deterministic data
- Quick unit test assertions with known ID
- Documentation examples
- Default values in Storybook stories
Caution: Avoid using in tests that depend on random fields being specific values. Use InvoiceBuilder for full control.
Example
// Use in tests with known ID
expect(mockInvoice.id).toBe("invoice-1");
expect(mockInvoice.name).toBe("Test Invoice");
// Use as default in Storybook
export const Default: Story = {
args: { invoice: mockInvoice },
};
See
- mockInvoiceList for pre-built list
- InvoiceBuilder for customized test data
// was this page useful?