You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

issues.ts 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import { Query } from '../../apps/issues/utils';
  21. import { IssueChangelog, IssueChangelogDiff } from '../../types/types';
  22. export function mockIssueAuthors(overrides: string[] = []): string[] {
  23. return [
  24. 'email1@sonarsource.com',
  25. 'email2@sonarsource.com',
  26. 'email3@sonarsource.com',
  27. 'email4@sonarsource.com',
  28. ...overrides,
  29. ];
  30. }
  31. export function mockIssueChangelog(overrides: Partial<IssueChangelog> = {}): IssueChangelog {
  32. return {
  33. creationDate: '2018-10-01',
  34. isUserActive: true,
  35. user: 'luke.skywalker',
  36. userName: 'Luke Skywalker',
  37. diffs: [mockIssueChangelogDiff()],
  38. ...overrides,
  39. };
  40. }
  41. export function mockIssueChangelogDiff(
  42. overrides: Partial<IssueChangelogDiff> = {},
  43. ): IssueChangelogDiff {
  44. return {
  45. key: 'assign',
  46. newValue: 'darth.vader',
  47. oldValue: 'luke.skywalker',
  48. ...overrides,
  49. };
  50. }
  51. export function mockQuery(overrides: Partial<Query> = {}): Query {
  52. return {
  53. assigned: false,
  54. assignees: [],
  55. author: [],
  56. cleanCodeAttributeCategories: [],
  57. codeVariants: [],
  58. createdAfter: undefined,
  59. createdAt: '',
  60. createdBefore: undefined,
  61. createdInLast: '',
  62. cwe: [],
  63. directories: [],
  64. files: [],
  65. issues: [],
  66. languages: [],
  67. owaspTop10: [],
  68. 'owaspTop10-2021': [],
  69. 'pciDss-3.2': [],
  70. 'pciDss-4.0': [],
  71. 'owaspAsvs-4.0': [],
  72. owaspAsvsLevel: '',
  73. projects: [],
  74. rules: [],
  75. scopes: [],
  76. severities: [],
  77. impactSeverities: [],
  78. impactSoftwareQualities: [],
  79. inNewCodePeriod: false,
  80. sonarsourceSecurity: [],
  81. issueStatuses: [],
  82. sort: '',
  83. tags: [],
  84. types: [],
  85. ...overrides,
  86. };
  87. }