mirror of
https://github.com/acedanger/finance.git
synced 2025-12-06 07:00:13 -08:00
style: apply Biome formatting to TypeScript files (#27)
- Fix import sorting - Standardize code formatting - Apply consistent TypeScript style - Update code to match Biome configuration Part of #27
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { GET as listAccounts } from '../pages/api/accounts/index';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { GET as getAccount } from '../pages/api/accounts/[id]/index';
|
||||
import { GET as listTransactions } from '../pages/api/accounts/[id]/transactions/index';
|
||||
import { GET as listAccounts } from '../pages/api/accounts/index';
|
||||
import { createMockAPIContext } from './setup';
|
||||
|
||||
describe('Accounts API', () => {
|
||||
@@ -48,7 +48,7 @@ describe('Accounts API', () => {
|
||||
|
||||
it('should return empty array for account with no transactions', async () => {
|
||||
const response = await listTransactions(
|
||||
createMockAPIContext({ params: { id: '999' } }) as any
|
||||
createMockAPIContext({ params: { id: '999' } }) as any,
|
||||
);
|
||||
const transactions = await response.json();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { APIContext } from 'astro';
|
||||
import { beforeEach } from 'vitest';
|
||||
import { accounts, transactions } from '../data/store';
|
||||
import type { APIContext } from 'astro';
|
||||
|
||||
// Create a mock APIContext factory
|
||||
export function createMockAPIContext<T extends Record<string, string> = Record<string, string>>({
|
||||
@@ -43,7 +43,7 @@ beforeEach(() => {
|
||||
name: 'Test Savings',
|
||||
last4: '5678',
|
||||
balance: 5000.0,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Reset transactions to initial state
|
||||
@@ -62,6 +62,6 @@ beforeEach(() => {
|
||||
date: '2025-04-24',
|
||||
description: 'Test Transaction 2',
|
||||
amount: 100.0,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
// - Add load testing for API endpoints
|
||||
// - Implement test data factories
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { POST as createTransaction } from '../pages/api/transactions/index';
|
||||
import {
|
||||
PUT as updateTransaction,
|
||||
DELETE as deleteTransaction,
|
||||
} from '../pages/api/transactions/[id]/index';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { accounts, transactions } from '../data/store';
|
||||
import {
|
||||
DELETE as deleteTransaction,
|
||||
PUT as updateTransaction,
|
||||
} from '../pages/api/transactions/[id]/index';
|
||||
import { POST as createTransaction } from '../pages/api/transactions/index';
|
||||
import type { Transaction } from '../types';
|
||||
import { createMockAPIContext } from './setup';
|
||||
|
||||
@@ -273,7 +273,7 @@ describe('Transactions API', () => {
|
||||
const initialCount = transactions.length;
|
||||
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: '1' } }) as any
|
||||
createMockAPIContext({ params: { id: '1' } }) as any,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(204);
|
||||
@@ -292,7 +292,7 @@ describe('Transactions API', () => {
|
||||
|
||||
it('should return 404 for non-existent transaction', async () => {
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: '999' } }) as any
|
||||
createMockAPIContext({ params: { id: '999' } }) as any,
|
||||
);
|
||||
|
||||
const error = await response.json();
|
||||
@@ -313,7 +313,7 @@ describe('Transactions API', () => {
|
||||
transactions.push(testTransaction);
|
||||
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: 'test-delete' } }) as any
|
||||
createMockAPIContext({ params: { id: 'test-delete' } }) as any,
|
||||
);
|
||||
|
||||
const error = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user