From 2b5ce1bad12d578b0052ae3739779e1a384ddea5 Mon Sep 17 00:00:00 2001 From: xilesun <2013xile@gmail.com> Date: Thu, 27 Feb 2025 00:11:54 +0800 Subject: [PATCH] fix(acl): test --- .../src/server/__tests__/list-action.test.ts | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/list-action.test.ts b/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/list-action.test.ts index 17a9759c5c..80721cf474 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/list-action.test.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/list-action.test.ts @@ -279,23 +279,11 @@ describe('list action with acl', () => { }, }); - app.resourcer.use( - (ctx, next) => { - ctx.state.currentRole = 'user'; - ctx.state.currentUser = { - id: 1, - tag: 'c', - }; - - return next(); - }, - { - before: 'acl', - after: 'auth', - }, - ); - - const response = await (app as any).agent().set('X-With-ACL-Meta', true).resource('posts').list(); + // @ts-ignore + const response = await (await app.agent().login(users[0].id, 'user')) + .set('X-With-ACL-Meta', true) + .resource('posts') + .list(); const data = response.body; expect(data.meta.allowedActions.view).toEqual([1, 2, 3]); expect(data.meta.allowedActions.update).toEqual([2, 3]);