Skip to main content

Function: generateRandomInvoice()

@arolariu/website


@arolariu/website / data/mocks/invoice / generateRandomInvoice

Function: generateRandomInvoice()

generateRandomInvoice(): Invoice

Defined in: data/mocks/invoice.ts:951

Generates a complete random invoice with items and recipes for testing.

Returns

Invoice

Fully populated random Invoice object

Remarks

Convenience Function: Shorthand for creating a fully-populated test invoice with a single function call.

Generated Data:

  • Random UUIDv4 for all identifiers
  • 3-10 random product items with realistic data
  • 0-3 random recipe suggestions
  • Realistic payment information with random currency
  • InvoiceCategory.GROCERY as default category
  • Single JPEG scan with random URL

Use Cases:

  • Unit test fixtures requiring complete invoices
  • Storybook component examples
  • Development seed data
  • Integration test scenarios

Determinism: Each call generates different random data. For deterministic tests, use mockInvoice or configure faker.js seed.

Example

const testInvoice = generateRandomInvoice();

expect(testInvoice.id).toBeDefined();
expect(testInvoice.items.length).toBeGreaterThan(0);
expect(testInvoice.paymentInformation).toBeDefined();

See

// was this page useful?