scottohara/loot

View on GitHub
src/mocks/categories/factories/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import type { Category } from "~/categories/types";

let id = 1;

export default function createCategory(
    props: Partial<Category> = {},
): Category {
    id++;

    return {
        id,
        name: `Category ${id}`,
        closing_balance: 0,
        direction: "inflow" as const,
        parent_id: null,
        favourite: false,
        num_transactions: 0,
        ...props,
    };
}