mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
5625b8838c
* chore(core,ui): coverage ignore src/__mocks__/ * chore(core): build excludes src/__mocks__/ * refactor(core): split mock.ts into __mocks__/*.ts
20 lines
571 B
TypeScript
20 lines
571 B
TypeScript
import { Role } from '@logto/schemas';
|
|
|
|
import { mockRole } from '@/__mocks__';
|
|
import { createRequester } from '@/utils/test-utils';
|
|
|
|
import roleRoutes from './role';
|
|
|
|
jest.mock('@/queries/roles', () => ({
|
|
findAllRoles: jest.fn(async (): Promise<Role[]> => [mockRole]),
|
|
}));
|
|
|
|
describe('role routes', () => {
|
|
const roleRequester = createRequester({ authedRoutes: roleRoutes });
|
|
|
|
it('GET /roles', async () => {
|
|
const response = await roleRequester.get('/roles');
|
|
expect(response.status).toEqual(200);
|
|
expect(response.body).toEqual([mockRole]);
|
|
});
|
|
});
|