canCreateProject.spec.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {canCreateProject} from './canCreateProject';
  3. describe('ProjectCreationAccess', function () {
  4. const organization = OrganizationFixture();
  5. it('passes project creation eligibility for org-manager', function () {
  6. const result = canCreateProject(organization);
  7. expect(result).toBeTruthy();
  8. });
  9. it('passes for members if org has team-roles', function () {
  10. const experiment_org = OrganizationFixture({
  11. access: ['org:read', 'team:read', 'project:read'],
  12. features: ['team-roles'],
  13. allowMemberProjectCreation: true,
  14. });
  15. const result = canCreateProject(experiment_org);
  16. expect(result).toBeTruthy();
  17. });
  18. it('fails for members if org has team-roles but disabled allowMemberProjectCreation', function () {
  19. const experiment_org = OrganizationFixture({
  20. access: ['org:read', 'team:read', 'project:read'],
  21. features: ['team-roles'],
  22. allowMemberProjectCreation: false,
  23. });
  24. const result = canCreateProject(experiment_org);
  25. expect(result).toBeFalsy();
  26. });
  27. it('fails for members if org does not have team-roles', function () {
  28. const no_team_role_org = OrganizationFixture({
  29. access: ['org:read', 'team:read', 'project:read'],
  30. });
  31. const result = canCreateProject(no_team_role_org);
  32. expect(result).toBeFalsy();
  33. });
  34. });