From 9096c509071a41f3493c8f20d790f8268e5a58cb Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Tue, 26 Jul 2022 14:29:38 +0800 Subject: [PATCH] test: integration tests for logs (#1671) --- packages/integration-tests/tests/logs.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/integration-tests/tests/logs.test.ts diff --git a/packages/integration-tests/tests/logs.test.ts b/packages/integration-tests/tests/logs.test.ts new file mode 100644 index 000000000..2c00b81da --- /dev/null +++ b/packages/integration-tests/tests/logs.test.ts @@ -0,0 +1,22 @@ +import { LogDto } from '@logto/schemas'; +import { assert } from '@silverhand/essentials'; + +import { authedAdminApi } from '@/api'; +import { registerUserAndSignIn } from '@/helper'; + +describe('admin console logs', () => { + it('should get logs and visit log details successfully', async () => { + await registerUserAndSignIn(); + + const logs = await authedAdminApi.get('logs').json(); + + 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(); + + expect(logDetails.id).toBe(log.id); + }); +});