forked from verdnatura/salix-front
chore: refs #4074 fix tests
This commit is contained in:
parent
ee62f85250
commit
bd00f86d74
|
@ -48,40 +48,62 @@ describe('useAcl', () => {
|
||||||
|
|
||||||
describe('hasAny', () => {
|
describe('hasAny', () => {
|
||||||
it('should return false if no roles matched', async () => {
|
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 () => {
|
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('*', () => {
|
describe('*', () => {
|
||||||
it('should return true if an acl matched', async () => {
|
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 () => {
|
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', () => {
|
describe('$authenticated', () => {
|
||||||
it('should return false if no acls matched', async () => {
|
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 () => {
|
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', () => {
|
describe('$everyone', () => {
|
||||||
it('should return false if no acls matched', async () => {
|
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 () => {
|
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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue