getProjectsByTeams.spec.jsx 803 B

1234567891011121314151617181920212223
  1. import {Project} from 'fixtures/js-stubs/project';
  2. import {Team} from 'fixtures/js-stubs/team';
  3. import getProjectsByTeams from 'sentry/utils/getProjectsByTeams';
  4. describe('getProjectsByTeams', function () {
  5. let projectsByTeams;
  6. beforeEach(function () {
  7. const team1 = Team({id: '1', slug: 'team1'});
  8. const team2 = Team({id: '2', slug: 'team2'});
  9. const teams = [team1, team2];
  10. const projects = [Project({slug: 'project1', teams}), Project({slug: 'project2'})];
  11. projectsByTeams = getProjectsByTeams(teams, projects);
  12. });
  13. it('lists projects by team', function () {
  14. expect(Object.keys(projectsByTeams.projectsByTeam)).toEqual(['team1', 'team2']);
  15. });
  16. it('lists teamless projecrts', function () {
  17. expect(projectsByTeams.teamlessProjects).toHaveLength(1);
  18. });
  19. });