Refactor test configuration and update type definitions for better compatibility with Prisma

This commit is contained in:
GitHub Copilot
2025-05-06 11:17:58 +00:00
parent 4bf29c70eb
commit bfa57a9655
3 changed files with 30 additions and 5 deletions

View File

@@ -9,8 +9,6 @@
"astro": "astro",
"test": "vitest run",
"test:watch": "vitest",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"format": "biome format --write .",
"lint": "biome lint .",

View File

@@ -1,3 +1,5 @@
import type { Decimal } from '@prisma/client/runtime/library';
export interface Account {
id: string;
bankName: string;
@@ -6,7 +8,7 @@ export interface Account {
type?: string; // CHECKING, SAVINGS, etc.
status?: string; // ACTIVE, CLOSED
currency?: string; // Default: USD
balance: number; // Current balance
balance: number | Decimal; // Current balance - can be Prisma Decimal or number
notes?: string; // Optional notes
createdAt?: Date;
updatedAt?: Date;
@@ -17,7 +19,7 @@ export interface Transaction {
accountId: string;
date: string | Date; // ISO date string or Date object
description: string;
amount: number;
amount: number | Decimal; // Amount - can be Prisma Decimal or number
category?: string; // Optional category
status?: string; // PENDING, CLEARED
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
@@ -26,3 +28,29 @@ export interface Transaction {
createdAt?: 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',
}

View File

@@ -11,7 +11,6 @@ export default defineConfig({
passWithNoTests: true,
teardownTimeout: 5000,
// Testing environment setup
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
// Ensure we're using the right environment
environment: 'node',