mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
21 lines
554 B
TypeScript
21 lines
554 B
TypeScript
|
import { Role } from '@logto/schemas';
|
||
|
|
||
|
import { mockRole } from '@/utils/mock';
|
||
|
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(roleRoutes);
|
||
|
|
||
|
it('GET /roles', async () => {
|
||
|
const response = await roleRequester.get('/roles');
|
||
|
expect(response.status).toEqual(200);
|
||
|
expect(response.body).toEqual([mockRole]);
|
||
|
});
|
||
|
});
|