Files
forgery/src/api/generation.test.ts
T
google-labs-jules[bot] 299be74d66 feat: backend infra setup with prisma, services, and apis
- Added Prisma schema with Asset, Character, Equipment, Generation, Category models
- Configured SQLite with LibSQL adapter
- Implemented Service layer (src/service) with unit tests
- Implemented API layer (src/api) with Hono and integration tests
- Added static file serving for assets
- Configured CI/CD with GitHub Actions
- Added Developer Guide (AGENTS.md)
2026-02-07 12:32:56 +00:00

32 lines
870 B
TypeScript

import { describe, it, expect, mock, afterEach } from 'bun:test'
import generation from './generation'
const mockGenerationService = {
listGenerations: mock(),
}
mock.module('../service/generation', () => ({
GenerationService: mockGenerationService,
}))
describe('Generation API', () => {
afterEach(() => {
mockGenerationService.listGenerations.mockClear()
})
it('GET / should list generations with filters', async () => {
mockGenerationService.listGenerations.mockResolvedValue({ items: [], total: 0 })
const req = new Request('http://localhost/?equipmentId=eq1', {
method: 'GET',
})
const res = await generation.fetch(req)
expect(res.status).toBe(200)
expect(mockGenerationService.listGenerations).toHaveBeenCalledWith(
{ page: 1, limit: 10 },
{ characterId: undefined, equipmentId: 'eq1' },
)
})
})