From 3220173e83a80448d1e783de41e362c993fbe310 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Fri, 3 Nov 2023 16:19:11 +0800 Subject: [PATCH] test(custom-request): update test case, avoid failed (#2954) * test(custom-request): update test case, avoid failed * fix: case --- .../__snapshots__/actions.test.ts.snap | 20 ------------------- .../src/server/__tests__/actions.test.ts | 4 +++- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/__snapshots__/actions.test.ts.snap b/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/__snapshots__/actions.test.ts.snap index bd9980513..81af83be9 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/__snapshots__/actions.test.ts.snap +++ b/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/__snapshots__/actions.test.ts.snap @@ -7,23 +7,3 @@ exports[`actions send currentRecord.data 1`] = ` "username": "testname", } `; - -exports[`actions send currentUser with association data 1`] = ` -{ - "a": [ - "member", - "root", - "admin", - ], - "b": [ - "{{t("Member")}}", - "{{t("Root")}}", - "{{t("Admin")}}", - ], - "c": [ - 1, - 1, - 1, - ], -} -`; diff --git a/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/actions.test.ts b/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/actions.test.ts index 4f0ef1d0b..8e2d5546e 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/actions.test.ts +++ b/packages/plugins/@nocobase/plugin-custom-request/src/server/__tests__/actions.test.ts @@ -154,7 +154,9 @@ describe('actions', () => { filterByTk: 'currentUser-with-association-data', }); expect(res.status).toBe(200); - expect(params).toMatchSnapshot(); + expect(expect.arrayContaining(params.a)).toMatchObject(['root', 'member', 'admin']); + expect(expect.arrayContaining(params.b)).toMatchObject(['{{t("Member")}}', '{{t("Root")}}', '{{t("Admin")}}']); + expect(expect.arrayContaining(params.c)).toMatchObject([1, 1, 1]); }); }); });