0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/packages/core/src/routes/role.test.ts

21 lines
554 B
TypeScript
Raw Normal View History

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