From bd00f86d74e9b52af56b34a126faaba11c6109e6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 9 Sep 2024 14:09:29 +0200 Subject: [PATCH] chore: refs #4074 fix tests --- .../__tests__/composables/useAcl.spec.js | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/test/vitest/__tests__/composables/useAcl.spec.js b/test/vitest/__tests__/composables/useAcl.spec.js index a2b44b5e7..6cb29984c 100644 --- a/test/vitest/__tests__/composables/useAcl.spec.js +++ b/test/vitest/__tests__/composables/useAcl.spec.js @@ -48,40 +48,62 @@ describe('useAcl', () => { describe('hasAny', () => { it('should return false if no roles matched', async () => { - expect(acl.hasAny('Worker', 'updateAttributes', 'WRITE')).toBeFalsy(); + expect( + acl.hasAny([ + { model: 'Worker', props: 'updateAttributes', accessType: 'WRITE' }, + ]) + ).toBeFalsy(); }); it('should return false if no roles matched', async () => { - expect(acl.hasAny('Worker', 'holidays', 'READ')).toBeTruthy(); + expect( + acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }]) + ).toBeTruthy(); }); describe('*', () => { it('should return true if an acl matched', async () => { - expect(acl.hasAny('Address', '*', 'WRITE')).toBeTruthy(); + expect( + acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }]) + ).toBeTruthy(); }); it('should return false if no acls matched', async () => { - expect(acl.hasAny('Worker', '*', 'READ')).toBeFalsy(); + expect( + acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }]) + ).toBeFalsy(); }); }); describe('$authenticated', () => { it('should return false if no acls matched', async () => { - expect(acl.hasAny('Url', 'getByUser', '*')).toBeFalsy(); + expect( + acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }]) + ).toBeFalsy(); }); it('should return true if an acl matched', async () => { - expect(acl.hasAny('Url', 'getByUser', 'READ')).toBeTruthy(); + expect( + acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: 'READ' }]) + ).toBeTruthy(); }); }); describe('$everyone', () => { it('should return false if no acls matched', async () => { - expect(acl.hasAny('TpvTransaction', 'start', 'READ')).toBeFalsy(); + expect( + acl.hasAny([ + { model: 'TpvTransaction', props: 'start', accessType: 'READ' }, + ]) + ).toBeFalsy(); }); it('should return false if an acl matched', async () => { - expect(acl.hasAny('TpvTransaction', 'start', 'WRITE')).toBeTruthy(); + expect( + acl.hasAny([ + { model: 'TpvTransaction', props: 'start', accessType: 'WRITE' }, + ]) + ).toBeTruthy(); }); }); });