123456789101112131415161718192021222324252627282930313233343536373839 |
- import {OrganizationFixture} from 'sentry-fixture/organization';
- import {renderHook} 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} = 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} = 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} = renderHook(useProjectCreationAccess, {
- initialProps: {organization: no_team_role_org},
- });
- expect(result.current.canCreateProject).toBeFalsy();
- });
- });
|