19 lines
680 B
TypeScript
19 lines
680 B
TypeScript
jest.mock('#src/prisma/prisma.service', () => ({
|
|
PrismaService: class PrismaService {},
|
|
}));
|
|
|
|
import { BrokerageOperationsController } from './brokerage-operations.controller';
|
|
|
|
describe('BrokerageOperationsController', () => {
|
|
it('passes the authenticated user, account, and validated query to the service', async () => {
|
|
const operations = { read: jest.fn() };
|
|
const controller = new BrokerageOperationsController(operations as never);
|
|
const query = { limit: 10 };
|
|
const request = { user: { sub: 'user' } };
|
|
|
|
await controller.get(request as never, 'account', query);
|
|
|
|
expect(operations.read).toHaveBeenCalledWith('user', 'account', query);
|
|
});
|
|
});
|