0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00
logto/packages/core/src/routes/role.test.ts
2022-10-21 14:03:35 +08:00

20 lines
576 B
TypeScript

import type { 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]);
});
});