2022-07-26 01:29:38 -05:00
|
|
|
import { LogDto } from '@logto/schemas';
|
|
|
|
import { assert } from '@silverhand/essentials';
|
|
|
|
|
|
|
|
import { authedAdminApi } from '@/api';
|
2022-07-26 22:23:10 -05:00
|
|
|
import { registerUserAndSignIn } from '@/helpers';
|
2022-07-26 01:29:38 -05:00
|
|
|
|
|
|
|
describe('admin console logs', () => {
|
|
|
|
it('should get logs and visit log details successfully', async () => {
|
|
|
|
await registerUserAndSignIn();
|
|
|
|
|
|
|
|
const logs = await authedAdminApi.get('logs').json<LogDto[]>();
|
|
|
|
|
|
|
|
expect(logs.length).toBeGreaterThan(0);
|
|
|
|
|
|
|
|
const log = logs[0];
|
|
|
|
assert(log, new Error('Log is not valid'));
|
|
|
|
|
|
|
|
const logDetails = await authedAdminApi.get(`logs/${log.id}`).json<LogDto>();
|
|
|
|
|
|
|
|
expect(logDetails.id).toBe(log.id);
|
|
|
|
});
|
|
|
|
});
|