1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

feat: add tests

This commit is contained in:
Fredrik Oseberg 2021-12-01 14:52:13 +01:00 committed by Ivar Conradi Østhus
parent d8ab79f71c
commit 0129f23e97
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09

View File

@ -500,3 +500,29 @@ test('should support permission with "ALL" environment requirement', async () =>
);
expect(hasNotAccess).toBe(true);
});
test('Should have access to create a strategy in an environment', async () => {
const { CREATE_FEATURE_STRATEGY } = permissions;
const user = editorUser;
expect(
await accessService.hasPermission(
user,
CREATE_FEATURE_STRATEGY,
'default',
'development',
),
).toBe(true);
});
test('Should be denied access to create a strategy in an environment the user does not have access to', async () => {
const { CREATE_FEATURE_STRATEGY } = permissions;
const user = editorUser;
expect(
await accessService.hasPermission(
user,
CREATE_FEATURE_STRATEGY,
'default',
'noaccess',
),
).toBe(false);
});