getProjectsByTeams.spec.jsx 765 B

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