mirror of
https://github.com/acedanger/finance.git
synced 2025-12-06 07:00:13 -08:00
Merge branch 'main' of github.com:acedanger/finance
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import type { APIContext } from 'astro';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { listAccounts } from '../pages/api/accounts';
|
||||
import { getAccount } from '../pages/api/accounts/[id]';
|
||||
import { listTransactions } from '../pages/api/accounts/[id]/transactions';
|
||||
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', () => {
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
// - Add load testing for API endpoints
|
||||
// - Implement test data factories
|
||||
|
||||
import type { APIContext } from 'astro';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { accounts, transactions } from '../data/store';
|
||||
import { createTransaction } from '../pages/api/transactions';
|
||||
import { updateTransaction } from '../pages/api/transactions/[id]';
|
||||
import { DELETE as deleteTransaction } from '../pages/api/transactions/[id]/index';
|
||||
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';
|
||||
|
||||
@@ -272,7 +273,7 @@ describe('Transactions API', () => {
|
||||
const initialCount = transactions.length;
|
||||
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: '1' } }) as APIContext,
|
||||
createMockAPIContext({ params: { id: '1' } }) as any,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(204);
|
||||
@@ -291,7 +292,7 @@ describe('Transactions API', () => {
|
||||
|
||||
it('should return 404 for non-existent transaction', async () => {
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: '999' } }) as APIContext,
|
||||
createMockAPIContext({ params: { id: '999' } }) as any,
|
||||
);
|
||||
|
||||
const error = await response.json();
|
||||
@@ -312,7 +313,7 @@ describe('Transactions API', () => {
|
||||
transactions.push(testTransaction);
|
||||
|
||||
const response = await deleteTransaction(
|
||||
createMockAPIContext({ params: { id: 'test-delete' } }) as APIContext,
|
||||
createMockAPIContext({ params: { id: 'test-delete' } }) as any,
|
||||
);
|
||||
|
||||
const error = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user