0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00
logto/packages/integration-tests/tests/logs.test.ts
simeng-li 0957899d57
refactor(test): refactor log, dashboard, me (#1692)
* refactor(test): refactor me,logs, dashboard

refactor me,logs, dashboard

* fix(test): cr update

cr update
2022-07-28 02:30:37 +00:00

30 lines
894 B
TypeScript

import { assert } from '@silverhand/essentials';
import { getLogs, getLog } from '@/api';
import { registerNewUser } from '@/helpers';
import { generateUsername, generatePassword } from '@/utils';
describe('admin console logs', () => {
const username = generateUsername();
const password = generatePassword();
it('should get logs and visit log details successfully', async () => {
await registerNewUser(username, password);
const logs = await getLogs();
const registerLog = logs.filter(
({ type, payload }) =>
type === 'RegisterUsernamePassword' &&
(payload as Record<string, unknown>).username === username
);
expect(registerLog.length).toBeGreaterThan(0);
assert(registerLog[0], new Error('Log is not valid'));
const logDetails = await getLog(registerLog[0].id);
expect(logDetails).toMatchObject(registerLog[0]);
});
});