mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 14:40:13 -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",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"format": "biome format --write .",
|
||||
"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 {
|
||||
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',
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user