mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
|
|
import {reactHooks} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import {useProjectCreationAccess} from './useProjectCreationAccess';
|
|
|
|
describe('ProjectCreationAccess', function () {
|
|
const organization = OrganizationFixture();
|
|
|
|
it('passes project creation eligibility for org-manager', function () {
|
|
const {result} = reactHooks.renderHook(useProjectCreationAccess, {
|
|
initialProps: {organization},
|
|
});
|
|
expect(result.current.canCreateProject).toBeTruthy();
|
|
});
|
|
|
|
it('passes for members if org has team-roles', function () {
|
|
const experiment_org = OrganizationFixture({
|
|
access: ['org:read', 'team:read', 'project:read'],
|
|
features: ['team-roles'],
|
|
});
|
|
|
|
const {result} = reactHooks.renderHook(useProjectCreationAccess, {
|
|
initialProps: {organization: experiment_org},
|
|
});
|
|
expect(result.current.canCreateProject).toBeTruthy();
|
|
});
|
|
|
|
it('fails for members if org does not have team-roles', function () {
|
|
const no_team_role_org = OrganizationFixture({
|
|
access: ['org:read', 'team:read', 'project:read'],
|
|
});
|
|
|
|
const {result} = reactHooks.renderHook(useProjectCreationAccess, {
|
|
initialProps: {organization: no_team_role_org},
|
|
});
|
|
expect(result.current.canCreateProject).toBeFalsy();
|
|
});
|
|
});
|