mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
Refactor test configuration and update type definitions for better compatibility with Prisma
This commit is contained in:
@@ -9,8 +9,6 @@
|
|||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"test": "vitest run",
|
|
||||||
"test:watch": "vitest",
|
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
"format": "biome format --write .",
|
"format": "biome format --write .",
|
||||||
"lint": "biome lint .",
|
"lint": "biome lint .",
|
||||||
|
|||||||
32
src/types.ts
32
src/types.ts
@@ -1,3 +1,5 @@
|
|||||||
|
import type { Decimal } from '@prisma/client/runtime/library';
|
||||||
|
|
||||||
export interface Account {
|
export interface Account {
|
||||||
id: string;
|
id: string;
|
||||||
bankName: string;
|
bankName: string;
|
||||||
@@ -6,7 +8,7 @@ export interface Account {
|
|||||||
type?: string; // CHECKING, SAVINGS, etc.
|
type?: string; // CHECKING, SAVINGS, etc.
|
||||||
status?: string; // ACTIVE, CLOSED
|
status?: string; // ACTIVE, CLOSED
|
||||||
currency?: string; // Default: USD
|
currency?: string; // Default: USD
|
||||||
balance: number; // Current balance
|
balance: number | Decimal; // Current balance - can be Prisma Decimal or number
|
||||||
notes?: string; // Optional notes
|
notes?: string; // Optional notes
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
@@ -17,7 +19,7 @@ export interface Transaction {
|
|||||||
accountId: string;
|
accountId: string;
|
||||||
date: string | Date; // ISO date string or Date object
|
date: string | Date; // ISO date string or Date object
|
||||||
description: string;
|
description: string;
|
||||||
amount: number;
|
amount: number | Decimal; // Amount - can be Prisma Decimal or number
|
||||||
category?: string; // Optional category
|
category?: string; // Optional category
|
||||||
status?: string; // PENDING, CLEARED
|
status?: string; // PENDING, CLEARED
|
||||||
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
|
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
|
||||||
@@ -26,3 +28,29 @@ export interface Transaction {
|
|||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type definitions for Transaction status and type enums to match db.service.ts
|
||||||
|
export enum TransactionStatus {
|
||||||
|
PENDING = 'PENDING',
|
||||||
|
CLEARED = 'CLEARED',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum TransactionType {
|
||||||
|
DEPOSIT = 'DEPOSIT',
|
||||||
|
WITHDRAWAL = 'WITHDRAWAL',
|
||||||
|
TRANSFER = 'TRANSFER',
|
||||||
|
UNSPECIFIED = 'UNSPECIFIED',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AccountType {
|
||||||
|
CHECKING = 'CHECKING',
|
||||||
|
SAVINGS = 'SAVINGS',
|
||||||
|
CREDIT_CARD = 'CREDIT_CARD',
|
||||||
|
INVESTMENT = 'INVESTMENT',
|
||||||
|
OTHER = 'OTHER',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AccountStatus {
|
||||||
|
ACTIVE = 'ACTIVE',
|
||||||
|
CLOSED = 'CLOSED',
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export default defineConfig({
|
|||||||
passWithNoTests: true,
|
passWithNoTests: true,
|
||||||
teardownTimeout: 5000,
|
teardownTimeout: 5000,
|
||||||
// Testing environment setup
|
// Testing environment setup
|
||||||
environment: 'jsdom',
|
|
||||||
setupFiles: ['./src/test/setup.ts'],
|
setupFiles: ['./src/test/setup.ts'],
|
||||||
// Ensure we're using the right environment
|
// Ensure we're using the right environment
|
||||||
environment: 'node',
|
environment: 'node',
|
||||||
|
|||||||
Reference in New Issue
Block a user