mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 09:59:22 +00:00
refactor(api): enforce layered architecture by moving db queries to core services
This commit is contained in:
@@ -11,22 +11,15 @@ vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
return {
|
||||
...actual,
|
||||
prisma: {
|
||||
agent: {
|
||||
findUnique: vi.fn().mockResolvedValue({ teamId: 'team1' }),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
describe('Agent API', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
vi.mocked(agentService.getAgent).mockResolvedValue({
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
})
|
||||
|
||||
describe('GET /teams/:teamId/agents', () => {
|
||||
|
||||
Reference in New Issue
Block a user