Skip to main content

Variable: mockInvoice

@arolariu/website


@arolariu/website / data/mocks/invoice / mockInvoice

Variable: mockInvoice

const mockInvoice: 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:

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

// was this page useful?