teamMocks.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { Team, TeamGroup, TeamMember, TeamPermissionLevel } from 'app/types';
  2. export const getMultipleMockTeams = (numberOfTeams: number): Team[] => {
  3. const teams: Team[] = [];
  4. for (let i = 1; i <= numberOfTeams; i++) {
  5. teams.push({
  6. id: i,
  7. name: `test-${i}`,
  8. avatarUrl: 'some/url/',
  9. email: `test-${i}@test.com`,
  10. memberCount: i,
  11. permission: TeamPermissionLevel.Member,
  12. });
  13. }
  14. return teams;
  15. };
  16. export const getMockTeam = (): Team => {
  17. return {
  18. id: 1,
  19. name: 'test',
  20. avatarUrl: 'some/url/',
  21. email: 'test@test.com',
  22. memberCount: 1,
  23. permission: TeamPermissionLevel.Member,
  24. };
  25. };
  26. export const getMockTeamMembers = (amount: number, teamAdminId: number): TeamMember[] => {
  27. const teamMembers: TeamMember[] = [];
  28. for (let i = 1; i <= amount; i++) {
  29. teamMembers.push({
  30. userId: i,
  31. teamId: 1,
  32. avatarUrl: 'some/url/',
  33. email: 'test@test.com',
  34. name: 'testName',
  35. login: `testUser-${i}`,
  36. labels: ['label 1', 'label 2'],
  37. permission: i === teamAdminId ? TeamPermissionLevel.Admin : TeamPermissionLevel.Member,
  38. });
  39. }
  40. return teamMembers;
  41. };
  42. export const getMockTeamMember = (): TeamMember => {
  43. return {
  44. userId: 1,
  45. teamId: 1,
  46. avatarUrl: 'some/url/',
  47. email: 'test@test.com',
  48. name: 'testName',
  49. login: 'testUser',
  50. labels: [],
  51. permission: TeamPermissionLevel.Member,
  52. };
  53. };
  54. export const getMockTeamGroups = (amount: number): TeamGroup[] => {
  55. const groups: TeamGroup[] = [];
  56. for (let i = 1; i <= amount; i++) {
  57. groups.push({
  58. groupId: `group-${i}`,
  59. teamId: 1,
  60. });
  61. }
  62. return groups;
  63. };