mock_data.js 25.8 KB
Newer Older
1
import { GlFilteredSearchToken } from '@gitlab/ui';
2 3
import { getTimeframeForRangeType } from 'ee/roadmap/utils/roadmap_utils';
import { DATE_RANGES, PRESET_TYPES } from 'ee/roadmap/constants';
4 5

import { dateFromString } from 'helpers/datetime_helpers';
6 7 8 9
import {
  OPERATOR_IS_ONLY,
  OPERATOR_IS_AND_IS_NOT,
} from '~/vue_shared/components/filtered_search_bar/constants';
10 11 12 13 14 15

import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
16

17 18
export const mockScrollBarSize = 15;

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
export const mockGroupId = 1;

const mockGroup1 = {
  id: `gid://gitlab/Group/${mockGroupId}`,
  name: 'Gitlab Org',
  fullName: 'Gitlab Org',
  fullPath: '/groups/gitlab-org/',
  __typename: 'Group',
};

const mockGroup2 = {
  id: 'gid://gitlab/Group/2',
  name: 'Marketing',
  fullName: 'Gitlab Org / Marketing',
  fullPath: '/groups/gitlab-org/marketing/',
  __typename: 'Group',
};
36 37 38

export const mockShellWidth = 2000;

39 40
export const mockItemWidth = 180;

41 42 43 44
export const mockSortedBy = 'start_date_asc';

export const basePath = '/groups/gitlab-org/-/epics.json';

45 46
export const mockNewEpicEndpoint = '/groups/gitlab-org/-/epics';

47 48
export const mockSvgPath = '/foo/bar.svg';

49 50
export const mockTimeframeInitialDate = new Date(2018, 0, 1);

51 52 53 54 55
const defaultDescendantCounts = {
  openedEpics: 0,
  closedEpics: 0,
};

56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
export const mockTimeframeQuartersPrepend = [
  {
    year: 2016,
    quarterSequence: 4,
    range: [new Date(2016, 9, 1), new Date(2016, 10, 1), new Date(2016, 11, 31)],
  },
  {
    year: 2017,
    quarterSequence: 1,
    range: [new Date(2017, 0, 1), new Date(2017, 1, 1), new Date(2017, 2, 31)],
  },
  {
    year: 2017,
    quarterSequence: 2,
    range: [new Date(2017, 3, 1), new Date(2017, 4, 1), new Date(2017, 5, 30)],
  },
];
export const mockTimeframeQuartersAppend = [
  {
    year: 2019,
    quarterSequence: 2,
    range: [new Date(2019, 3, 1), new Date(2019, 4, 1), new Date(2019, 5, 30)],
  },
  {
    year: 2019,
    quarterSequence: 3,
    range: [new Date(2019, 6, 1), new Date(2019, 7, 1), new Date(2019, 8, 30)],
  },
  {
    year: 2019,
    quarterSequence: 4,
    range: [new Date(2019, 9, 1), new Date(2019, 10, 1), new Date(2019, 11, 31)],
  },
];

export const mockTimeframeMonthsPrepend = [
92 93
  new Date(2017, 2, 1),
  new Date(2017, 3, 1),
94 95 96 97 98 99 100 101 102 103 104 105
  new Date(2017, 4, 1),
  new Date(2017, 5, 1),
  new Date(2017, 6, 1),
  new Date(2017, 7, 1),
  new Date(2017, 8, 1),
  new Date(2017, 9, 1),
];
export const mockTimeframeMonthsAppend = [
  new Date(2018, 6, 1),
  new Date(2018, 7, 1),
  new Date(2018, 8, 1),
  new Date(2018, 9, 1),
106 107
  new Date(2018, 10, 1),
  new Date(2018, 11, 31),
108 109 110
];

export const mockTimeframeWeeksPrepend = [
Kushal Pandya's avatar
Kushal Pandya committed
111
  new Date(2017, 10, 5),
112 113 114 115 116 117 118 119 120 121 122 123 124 125
  new Date(2017, 10, 12),
  new Date(2017, 10, 19),
  new Date(2017, 10, 26),
  new Date(2017, 11, 3),
  new Date(2017, 11, 10),
];
export const mockTimeframeWeeksAppend = [
  new Date(2018, 0, 28),
  new Date(2018, 1, 4),
  new Date(2018, 1, 11),
  new Date(2018, 1, 18),
  new Date(2018, 1, 25),
  new Date(2018, 2, 4),
];
126

127 128 129 130 131 132 133 134 135 136
const OCT_11_2020 = dateFromString('Oct 11 2020');
export const mockWeekly = {
  currentDate: OCT_11_2020,
  /*
    Each item in timeframe is a Date object.

    timeframe = [ Sep 27 2020, Oct  4 2020, Oct 11 2020, <- current week or currentIndex == 2
                  Oct 18 2020, Oct 25 2020, Nov  1 2020,
                  Nov  8 2020 ]
  */
137 138 139 140 141
  timeframe: getTimeframeForRangeType({
    timeframeRangeType: DATE_RANGES.CURRENT_QUARTER,
    presetType: PRESET_TYPES.WEEKS,
    initialDate: OCT_11_2020,
  }),
142 143 144 145 146 147 148 149 150 151 152 153
};

const DEC_1_2020 = dateFromString('Dec 1 2020');
export const mockMonthly = {
  currentDate: DEC_1_2020,
  /*
    Each item in timeframe is a Date object.

    timeframe = [ Oct 1 2020, Nov 1 2020, Dec 1 2020, <- current month == index 2
                  Jan 1 2021, Feb 1 2021, Mar 1 2021,
                  Apr 1 2021, May 31 2021 ]
  */
154 155 156 157 158
  timeframe: getTimeframeForRangeType({
    timeframeRangeType: DATE_RANGES.CURRENT_YEAR,
    presetType: PRESET_TYPES.MONTHS,
    initialDate: DEC_1_2020,
  }),
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
};

const DEC_25_2020 = dateFromString('Dec 25 2020');
export const mockQuarterly = {
  currentDate: DEC_25_2020,
  /*
    The format of quarterly timeframes differs from that of the monthly and weekly ones.

    For quarterly, each item in timeframe has the following shape:
      { quarterSequence: number, range: array<Dates>, year: number }

      Each item in range is a Date object.

      E.g., { 2020 Q2 } = { quarterSequence: 2, range: [ Apr 1 2020, May 1 2020, Jun 30 2020], year 2020 }

    timeframe = [ { 2020 Q2 }, { 2020 Q3 }, { 2020 Q4 }, <- current quarter == index 2
                  { 2021 Q1 }, { 2021 Q2 }, { 2021 Q3 },
                  { 2021 Q4 } ]
  */
178 179 180 181 182
  timeframe: getTimeframeForRangeType({
    timeframeRangeType: DATE_RANGES.THREE_YEARS,
    presetType: PRESET_TYPES.QUARTERS,
    initialDate: DEC_25_2020,
  }),
183 184
};

185 186 187
export const mockEpic = {
  id: 1,
  iid: 1,
188 189 190 191
  description:
    'Explicabo et soluta minus praesentium minima ab et voluptatem. Quas architecto vero corrupti voluptatibus labore accusantium consectetur. Aliquam aut impedit voluptates illum molestias aut harum. Aut non odio praesentium aut.\n\nQuo asperiores aliquid sed nobis. Omnis sint iste provident numquam. Qui voluptatem tempore aut aut voluptas dolorem qui.\n\nEst est nemo quod est. Odit modi eos natus cum illo aut. Expedita nostrum ea est omnis magnam ut eveniet maxime. Itaque ipsam provident minima et occaecati ut. Dicta est perferendis sequi perspiciatis rerum voluptatum deserunt.',
  title:
    'Cupiditate exercitationem unde harum reprehenderit maxime eius velit recusandae incidunt quia.',
192
  group: mockGroup1,
193 194
  startDate: new Date('2017-11-10'),
  originalStartDate: new Date('2017-11-10'),
195 196
  endDate: new Date('2018-06-02'),
  webUrl: '/groups/gitlab-org/-/epics/1',
197 198 199 200
  descendantCounts: {
    openedEpics: 3,
    closedEpics: 2,
  },
201 202
};

203
export const mockRawEpic = {
204 205 206 207
  __typename: 'Epic',
  parent: null,
  id: 'gid://gitlab/Epic/41',
  iid: '2',
208
  title: 'Another marketing',
209 210 211 212 213 214 215
  description: '',
  state: 'opened',
  startDate: '2017-06-26',
  dueDate: '2018-03-10',
  webUrl: 'http://gdk.test:3000/groups/gitlab-org/marketing/-/epics/1',
  hasChildren: false,
  hasParent: false,
Kushal Pandya's avatar
Kushal Pandya committed
216
  confidential: false,
217 218 219 220 221
  descendantWeightSum: {
    closedIssues: 3,
    openedIssues: 2,
    __typename: 'EpicDescendantWeights',
  },
222 223 224
  descendantCounts: {
    openedEpics: 3,
    closedEpics: 2,
225
    __typename: 'EpicDescendantCount',
226
  },
227 228 229 230 231 232 233
  group: mockGroup1,
};

export const mockRawEpic2 = {
  ...mockRawEpic,
  startDate: '2017-12-31',
  dueDate: '2018-02-15',
234 235
};

236 237 238 239 240
export const mockFormattedChildEpic1 = {
  id: 50,
  iid: 52,
  description: null,
  title: 'Marketing child epic 1',
241
  group: mockGroup1,
242 243 244 245 246 247 248 249 250 251 252 253
  startDate: new Date(2017, 10, 1),
  originalStartDate: new Date(2017, 5, 26),
  endDate: new Date(2018, 2, 10),
  originalEndDate: new Date(2018, 2, 10),
  startDateOutOfRange: true,
  endDateOutOfRange: false,
  webUrl: '/groups/gitlab-org/marketing/-/epics/5',
  newEpic: undefined,
  descendantWeightSum: {
    closedIssues: 3,
    openedIssues: 2,
  },
254
  descendantCounts: defaultDescendantCounts,
255 256 257 258 259 260 261 262
  isChildEpic: true,
};

export const mockFormattedChildEpic2 = {
  id: 51,
  iid: 53,
  description: null,
  title: 'Marketing child epic 2',
263
  group: mockGroup1,
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
  startDate: new Date(2017, 10, 1),
  originalStartDate: new Date(2017, 5, 26),
  endDate: new Date(2018, 2, 10),
  originalEndDate: new Date(2018, 2, 10),
  startDateOutOfRange: true,
  endDateOutOfRange: false,
  webUrl: '/groups/gitlab-org/marketing/-/epics/6',
  newEpic: undefined,
  descendantWeightSum: {
    closedIssues: 3,
    openedIssues: 2,
  },
  isChildEpic: true,
};

279
export const mockFormattedEpic = {
280
  ...mockRawEpic,
281
  startDate: new Date(2018, 0, 1),
282 283 284 285 286
  originalStartDate: new Date(2017, 5, 26),
  endDate: new Date(2018, 2, 10),
  originalEndDate: new Date(2018, 2, 10),
  startDateOutOfRange: true,
  endDateOutOfRange: false,
Kushal Pandya's avatar
Kushal Pandya committed
287
  confidential: false,
288
  isChildEpic: false,
289 290 291 292 293 294
};

export const mockFormattedEpic2 = {
  ...mockRawEpic2,
  isChildEpic: false,
  newEpic: undefined,
295
  startDateOutOfRange: true,
296
  endDateOutOfRange: false,
297
  startDate: new Date(2018, 0, 1),
298 299 300
  originalStartDate: new Date(2017, 11, 31),
  endDate: new Date(2018, 1, 15),
  originalEndDate: new Date(2018, 1, 15),
301 302
};

303 304 305 306 307 308
export const rawEpics = [
  {
    id: 41,
    iid: 2,
    description: null,
    title: 'Another marketing',
309 310 311
    startDate: '2017-12-26',
    endDate: '2018-03-10',
    webUrl: '/groups/gitlab-org/marketing/-/epics/2',
312 313 314 315 316
    descendantCounts: defaultDescendantCounts,
    hasParent: true,
    parent: {
      id: '40',
    },
317
    group: mockGroup2,
318 319 320 321 322 323
  },
  {
    id: 40,
    iid: 1,
    description: null,
    title: 'Marketing epic',
324 325 326
    startDate: '2017-12-25',
    endDate: '2018-03-09',
    webUrl: '/groups/gitlab-org/marketing/-/epics/1',
327 328
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
329
    group: mockGroup2,
330 331 332 333 334 335
  },
  {
    id: 39,
    iid: 12,
    description: null,
    title: 'Epic with end in first timeframe month',
336 337 338 339
    group: mockGroup1,
    startDate: '2017-04-02',
    endDate: '2017-11-30',
    webUrl: '/groups/gitlab-org/-/epics/12',
340 341
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
342 343 344 345 346 347
  },
  {
    id: 38,
    iid: 11,
    description: null,
    title: 'Epic with end date out of range',
348 349 350 351
    group: mockGroup2,
    startDate: '2018-01-15',
    endDate: '2020-01-03',
    webUrl: '/groups/gitlab-org/-/epics/11',
352 353
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
354 355 356 357 358 359
  },
  {
    id: 37,
    iid: 10,
    description: null,
    title: 'Epic with timeline in same month',
360 361 362 363
    group: mockGroup2,
    startDate: '2018-01-01',
    endDate: '2018-01-31',
    webUrl: '/groups/gitlab-org/-/epics/10',
364 365
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
366 367 368 369 370 371
  },
  {
    id: 35,
    iid: 8,
    description: null,
    title: 'Epic with out of range start & null end',
372 373 374 375
    group: mockGroup1,
    startDate: '2017-09-04',
    endDate: null,
    webUrl: '/groups/gitlab-org/-/epics/8',
376 377
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
378 379 380 381 382 383
  },
  {
    id: 33,
    iid: 6,
    description: null,
    title: 'Epic with only start date',
384 385 386 387
    group: mockGroup1,
    startDate: '2017-11-27',
    endDate: null,
    webUrl: '/groups/gitlab-org/-/epics/6',
388 389
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
390 391 392 393
  },
  {
    id: 4,
    iid: 4,
394 395
    description:
      'Animi dolorem error ipsam assumenda. Dolor reprehenderit sit soluta molestias id. Explicabo vel dolores numquam earum ut aliquid. Quisquam aliquam a totam laborum quia.\n\nEt voluptatem reiciendis qui cum. Labore ratione delectus minus et voluptates. Dolor voluptatem nisi neque fugiat ut ullam dicta odit. Aut quaerat provident ducimus aut molestiae hic esse.\n\nSuscipit non repellat laudantium quaerat. Voluptatum dolor explicabo vel illo earum. Laborum vero occaecati qui autem cumque dolorem autem. Enim voluptatibus a dolorem et.',
396
    title: 'Et repellendus quo et laboriosam corrupti ex nisi qui.',
397 398 399 400
    group: mockGroup1,
    startDate: '2018-01-01',
    endDate: '2018-02-02',
    webUrl: '/groups/gitlab-org/-/epics/4',
401 402
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
403 404 405 406
  },
  {
    id: 3,
    iid: 3,
407 408
    description:
      'Magnam placeat ut esse aut vel. Et sit ab soluta ut eos et et. Nesciunt expedita sit et optio maiores quas facilis. Provident ut aut et nihil. Nesciunt ipsum fuga labore dolor quia.\n\nSit suscipit impedit aut dolore non provident. Nesciunt nemo excepturi voluptatem natus veritatis. Vel ut possimus reiciendis dolorem et. Recusandae voluptatem voluptatum aut iure. Sapiente quia est iste similique quidem quia omnis et.\n\nId aut assumenda beatae iusto est dicta consequatur. Tempora voluptatem pariatur ab velit vero ut reprehenderit fuga. Dolor modi aspernatur eos atque eveniet harum sed voluptatem. Dolore iusto voluptas dolor enim labore dolorum consequatur dolores.',
409
    title: 'Nostrum ut nisi fugiat accusantium qui velit dignissimos.',
410 411 412 413
    group: mockGroup1,
    startDate: '2017-12-01',
    endDate: '2018-03-26',
    webUrl: '/groups/gitlab-org/-/epics/3',
414 415 416 417 418
    descendantCounts: defaultDescendantCounts,
    hasParent: true,
    parent: {
      id: '40',
    },
419 420 421 422
  },
  {
    id: 2,
    iid: 2,
423 424
    description:
      'Deleniti id facere numquam cum consectetur sint ipsum consequatur. Odit nihil harum consequuntur est nemo adipisci. Incidunt suscipit voluptatem et culpa at voluptatem consequuntur. Rerum aliquam earum quia consequatur ipsam quae ut.\n\nQuod molestias ducimus quia ratione nostrum ut adipisci. Fugiat officiis reiciendis repellendus quia ut ipsa. Voluptatum ut dolor perferendis nostrum. Porro a ducimus sequi qui quos ea. Earum velit architecto necessitatibus at dicta.\n\nModi aut non fugiat autem doloribus nobis ea. Sit quam corrupti blanditiis nihil tempora ratione enim ex. Aliquam quia ut impedit ut velit reprehenderit quae amet. Unde quod at dolorum eligendi in ducimus perspiciatis accusamus.',
425
    title: 'Sit beatae amet quaerat consequatur non repudiandae qui.',
426 427 428 429
    group: mockGroup1,
    startDate: '2017-11-26',
    endDate: '2018-03-22',
    webUrl: '/groups/gitlab-org/-/epics/2',
430 431
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
432 433 434 435
  },
  {
    id: 1,
    iid: 1,
436 437 438 439
    description:
      'Explicabo et soluta minus praesentium minima ab et voluptatem. Quas architecto vero corrupti voluptatibus labore accusantium consectetur. Aliquam aut impedit voluptates illum molestias aut harum. Aut non odio praesentium aut.\n\nQuo asperiores aliquid sed nobis. Omnis sint iste provident numquam. Qui voluptatem tempore aut aut voluptas dolorem qui.\n\nEst est nemo quod est. Odit modi eos natus cum illo aut. Expedita nostrum ea est omnis magnam ut eveniet maxime. Itaque ipsam provident minima et occaecati ut. Dicta est perferendis sequi perspiciatis rerum voluptatum deserunt.',
    title:
      'Cupiditate exercitationem unde harum reprehenderit maxime eius velit recusandae incidunt quia.',
440 441 442 443
    group: mockGroup1,
    startDate: '2017-07-10',
    endDate: '2018-06-02',
    webUrl: '/groups/gitlab-org/-/epics/1',
444 445
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
446
  },
447 448 449 450 451
  {
    id: 22,
    iid: 2,
    description: null,
    title: 'Epic with invalid dates',
452 453 454 455
    group: mockGroup2,
    startDate: '2018-12-26',
    endDate: '2018-03-10',
    webUrl: '/groups/gitlab-org/marketing/-/epics/22',
456 457
    descendantCounts: defaultDescendantCounts,
    hasParent: false,
458
  },
459
];
460 461 462

export const mockUnsortedEpics = [
  {
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
    title: 'Nov 10 2013 ~ Jun 01 2014; actual start date is Feb 1 2013',
    originalStartDate: dateFromString('Feb 1 2013'),
    startDate: dateFromString('Nov 10 2013'),
    endDate: dateFromString('Jun 1, 2014'),
  },
  {
    title: 'Oct 01 2013 ~ Nov 01 2013; actual due date is Nov 1 2014',
    startDate: dateFromString('Oct 1 2013'),
    originalEndDate: dateFromString('Nov 1 2014'),
    endDate: dateFromString('Nov 1, 2013'),
  },
  {
    title: 'Jan 01 2020 ~ Dec 01 2020; no fixed start date',
    startDateUndefined: true,
    startDate: dateFromString('Jan 1 2020'),
    endDate: dateFromString('Dec 1 2020'),
  },
  {
    title: 'Mar 01 2013 ~ Dec 01 2013; no fixed due date',
    startDate: dateFromString('Mar 1 2013'),
    endDateUndefined: true,
    endDate: dateFromString('Dec 1 2013'),
  },
  {
    title: 'Mar 12 2017 ~ Aug 20 2017',
488 489 490 491
    startDate: new Date(2017, 2, 12),
    endDate: new Date(2017, 7, 20),
  },
  {
492
    title: 'Jun 08 2015 ~ Apr 01 2016',
493 494 495 496
    startDate: new Date(2015, 5, 8),
    endDate: new Date(2016, 3, 1),
  },
  {
497
    title: 'Apr 12 2019 ~ Aug 30 2019',
498 499 500 501
    startDate: new Date(2019, 4, 12),
    endDate: new Date(2019, 7, 30),
  },
  {
502
    title: 'Mar 17 2014 ~ Aug 15 2015',
503 504 505 506
    startDate: new Date(2014, 3, 17),
    endDate: new Date(2015, 7, 15),
  },
];
507

508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
export const mockEpicNode1 = {
  __typename: 'Epic',
  parent: null,
  id: 'gid://gitlab/Epic/40',
  iid: '2',
  title: 'Marketing epic',
  description: 'Mock epic description',
  state: 'opened',
  startDate: '2017-12-25',
  dueDate: '2018-02-15',
  webUrl: 'http://gdk.test:3000/groups/gitlab-org/marketing/-/epics/1',
  hasChildren: false,
  hasParent: false,
  confidential: false,
  descendantWeightSum: {
    closedIssues: 3,
    openedIssues: 2,
    __typename: 'EpicDescendantWeights',
  },
  descendantCounts: {
    openedEpics: 3,
    closedEpics: 2,
    __typename: 'EpicDescendantCount',
  },
  group: mockGroup1,
};

export const mockEpicNode2 = {
  __typename: 'Epic',
  parent: null,
  id: 'gid://gitlab/Epic/41',
  iid: '3',
  title: 'Another marketing',
  startDate: '2017-12-26',
  dueDate: '2018-03-10',
  state: 'opened',
  webUrl: 'http://gdk.test:3000/groups/gitlab-org/marketing/-/epics/2',
  descendantWeightSum: {
    closedIssues: 0,
    openedIssues: 1,
    __typename: 'EpicDescendantWeights',
  },
  descendantCounts: {
    openedEpics: 0,
    closedEpics: 0,
    __typename: 'EpicDescendantCount',
  },
  group: mockGroup1,
};

export const mockGroupEpics = [mockEpicNode1, mockEpicNode2];

560 561 562 563 564 565 566 567
export const mockPageInfo = {
  endCursor: 'eyJzdGFydF9kYXRlIjoiMjAyMC0wOS0wMSIsImlkIjoiMzExIn0',
  hasNextPage: true,
  hasPreviousPage: true,
  startCursor: 'eyJzdGFydF9kYXRlIjoiMjAyMC0wNC0xOCIsImlkIjoiMjQ1In0',
  __typename: 'PageInfo',
};

568 569 570
export const mockGroupEpicsQueryResponse = {
  data: {
    group: {
571
      id: 'gid://gitlab/Group/1',
572 573 574 575 576
      name: 'Gitlab Org',
      epics: {
        edges: [
          {
            node: {
577
              ...mockEpicNode1,
578
            },
579
            __typename: 'EpicEdge',
580 581 582
          },
          {
            node: {
583
              ...mockEpicNode2,
584
            },
585
            __typename: 'EpicEdge',
586 587
          },
        ],
588 589 590
        pageInfo: {
          ...mockPageInfo,
        },
591
        __typename: 'EpicConnection',
592
      },
593
      __typename: 'Group',
594 595 596 597
    },
  },
};

598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614
export const mockChildEpicNode1 = {
  __typename: 'Epic',
  id: 'gid://gitlab/Epic/70',
  iid: '10',
  title: 'child epic title',
  description: null,
  state: 'opened',
  webUrl: 'http://gdk.test:3000/groups/gitlab-org/-/epics/10',
  startDate: null,
  dueDate: null,
  hasChildren: false,
  hasParent: true,
  confidential: false,
  descendantWeightSum: {
    closedIssues: 0,
    openedIssues: 0,
    __typename: 'EpicDescendantWeights',
615
  },
616 617 618 619
  descendantCounts: {
    openedEpics: 0,
    closedEpics: 0,
    __typename: 'EpicDescendantCount',
620
  },
621 622 623 624 625 626 627
  group: {
    name: 'Gitlab Org',
    fullName: 'Gitlab Org',
    fullPath: 'gitlab-org',
    __typename: 'Group',
  },
};
628

629 630 631 632 633 634 635 636
export const mockEpicChildEpicsQueryResponse = {
  data: {
    group: {
      id: 'gid://gitlab/Group/2',
      name: 'Gitlab Org',
      epic: {
        id: 'gid://gitlab/Epic/1',
        title: 'Error omnis quos consequatur',
637
        hasChildren: true,
638
        children: {
639 640 641 642 643 644 645 646 647
          edges: [
            {
              node: {
                ...mockChildEpicNode1,
              },
              __typename: 'EpicEdge',
            },
          ],
          __typename: 'EpicConnection',
648
        },
649
        __typename: 'Epic',
650
      },
651
      __typename: 'Group',
652 653 654
    },
  },
};
Florie Guibert's avatar
Florie Guibert committed
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704

export const mockMilestone = {
  id: 1,
  state: 'active',
  description:
    'Explicabo et soluta minus praesentium minima ab et voluptatem. Quas architecto vero corrupti voluptatibus labore accusantium consectetur. Aliquam aut impedit voluptates illum molestias aut harum. Aut non odio praesentium aut.\n\nQuo asperiores aliquid sed nobis. Omnis sint iste provident numquam. Qui voluptatem tempore aut aut voluptas dolorem qui.\n\nEst est nemo quod est. Odit modi eos natus cum illo aut. Expedita nostrum ea est omnis magnam ut eveniet maxime. Itaque ipsam provident minima et occaecati ut. Dicta est perferendis sequi perspiciatis rerum voluptatum deserunt.',
  title:
    'Cupiditate exercitationem unde harum reprehenderit maxime eius velit recusandae incidunt quia.',
  groupId: 2,
  groupName: 'Gitlab Org',
  groupFullName: 'Gitlab Org',
  startDate: new Date('2017-07-10'),
  endDate: new Date('2018-06-02'),
  webPath: '/groups/gitlab-org/-/milestones/1',
};

export const mockMilestone2 = {
  id: 2,
  state: 'active',
  description:
    'Explicabo et soluta minus praesentium minima ab et voluptatem. Quas architecto vero corrupti voluptatibus labore accusantium consectetur. Aliquam aut impedit voluptates illum molestias aut harum. Aut non odio praesentium aut.\n\nQuo asperiores aliquid sed nobis. Omnis sint iste provident numquam. Qui voluptatem tempore aut aut voluptas dolorem qui.\n\nEst est nemo quod est. Odit modi eos natus cum illo aut. Expedita nostrum ea est omnis magnam ut eveniet maxime. Itaque ipsam provident minima et occaecati ut. Dicta est perferendis sequi perspiciatis rerum voluptatum deserunt.',
  title: 'Milestone 2',
  groupId: 2,
  groupName: 'Gitlab Org',
  groupFullName: 'Gitlab Org',
  startDate: new Date('2017-11-10'),
  endDate: new Date('2018-07-02'),
  webPath: '/groups/gitlab-org/-/milestones/1',
};

export const mockFormattedMilestone = {
  id: 1,
  state: 'active',
  title:
    'Cupiditate exercitationem unde harum reprehenderit maxime eius velit recusandae incidunt quia.',
  description:
    'Explicabo et soluta minus praesentium minima ab et voluptatem. Quas architecto vero corrupti voluptatibus labore accusantium consectetur. Aliquam aut impedit voluptates illum molestias aut harum. Aut non odio praesentium aut.\n\nQuo asperiores aliquid sed nobis. Omnis sint iste provident numquam. Qui voluptatem tempore aut aut voluptas dolorem qui.\n\nEst est nemo quod est. Odit modi eos natus cum illo aut. Expedita nostrum ea est omnis magnam ut eveniet maxime. Itaque ipsam provident minima et occaecati ut. Dicta est perferendis sequi perspiciatis rerum voluptatum deserunt.',
  groupId: 2,
  groupName: 'Gitlab Org',
  groupFullName: 'Gitlab Org',
  startDate: new Date(2017, 10, 1),
  originalStartDate: new Date(2017, 5, 26),
  endDate: new Date(2018, 2, 10),
  originalEndDate: new Date(2018, 2, 10),
  startDateOutOfRange: true,
  endDateOutOfRange: false,
  webPath: '/groups/gitlab-org/-/milestones/1',
  newMilestone: undefined,
};

705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734
export const mockGroupMilestoneNode1 = {
  id: 'gid://gitlab/Milestone/40',
  title: 'Sprint - Tempore voluptatibus et aut consequatur similique animi dolores veritatis.',
  description: '',
  state: 'active',
  startDate: '2017-12-25',
  dueDate: '2018-03-09',
  webPath: '/gitlab-org/gitlab-org/-/milestones/1',
  projectMilestone: false,
  groupMilestone: true,
  subgroupMilestone: false,
  __typename: 'Milestone',
};

export const mockGroupMilestoneNode2 = {
  id: 'gid://gitlab/Milestone/41',
  description: 'Maiores dolor vel nihil non nam commodi.',
  title: 'Milestone 2',
  state: 'active',
  startDate: '2017-12-26',
  dueDate: '2018-03-10',
  webPath: '/gitlab-org/gitlab-test/-/milestones/2',
  projectMilestone: false,
  groupMilestone: true,
  subgroupMilestone: false,
  __typename: 'Milestone',
};

export const mockGroupMilestones = [mockGroupMilestoneNode1, mockGroupMilestoneNode2];

Florie Guibert's avatar
Florie Guibert committed
735 736 737 738 739 740 741 742 743
export const mockGroupMilestonesQueryResponse = {
  data: {
    group: {
      id: 'gid://gitlab/Group/2',
      name: 'Gitlab Org',
      milestones: {
        edges: [
          {
            node: {
744
              ...mockGroupMilestoneNode1,
Florie Guibert's avatar
Florie Guibert committed
745
            },
746
            __typename: 'MilestoneEdge',
Florie Guibert's avatar
Florie Guibert committed
747 748 749
          },
          {
            node: {
750
              ...mockGroupMilestoneNode2,
Florie Guibert's avatar
Florie Guibert committed
751
            },
752
            __typename: 'MilestoneEdge',
Florie Guibert's avatar
Florie Guibert committed
753 754
          },
        ],
755
        __typename: 'MilestoneConnection',
Florie Guibert's avatar
Florie Guibert committed
756
      },
757
      __typename: 'Group',
Florie Guibert's avatar
Florie Guibert committed
758 759 760
    },
  },
};
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791

export const mockEpicsWithParents = [
  {
    id: 'gid://gitlab-org/subgroup/Epic/1',
    hasParent: true,
    parent: {
      id: 'gid://gitlab-org/Epic/1',
    },
  },
  {
    id: 'gid://gitlab-org/subgroup/Epic/2',
    hasParent: true,
    parent: {
      id: 'gid://gitlab-org/subgroup/Epic/1',
    },
  },
  {
    id: 'gid://gitlab-org/subgroup/Epic/3',
    hasParent: true,
    parent: {
      id: 'gid://gitlab-org/subgroup/Epic/1',
    },
  },
  {
    id: 'gid://gitlab-org/subgroup/Epic/4',
    hasParent: true,
    parent: {
      id: 'gid://gitlab-org/subgroup/Epic/1',
    },
  },
];
792 793 794 795 796 797 798 799

export const mockAuthorTokenConfig = {
  type: 'author_username',
  icon: 'user',
  title: 'Author',
  unique: true,
  symbol: '@',
  token: AuthorToken,
800
  operators: OPERATOR_IS_AND_IS_NOT,
801
  recentSuggestionsStorageKey: 'gitlab-org-epics-recent-tokens-author_username',
802 803 804 805 806 807 808 809 810 811 812
  fetchAuthors: expect.any(Function),
  preloadedAuthors: [],
};

export const mockLabelTokenConfig = {
  type: 'label_name',
  icon: 'labels',
  title: 'Label',
  unique: false,
  symbol: '~',
  token: LabelToken,
813
  operators: OPERATOR_IS_AND_IS_NOT,
814
  recentSuggestionsStorageKey: 'gitlab-org-epics-recent-tokens-label_name',
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
  fetchLabels: expect.any(Function),
};

export const mockMilestoneTokenConfig = {
  type: 'milestone_title',
  icon: 'clock',
  title: 'Milestone',
  unique: true,
  symbol: '%',
  token: MilestoneToken,
  operators: OPERATOR_IS_ONLY,
  fetchMilestones: expect.any(Function),
};

export const mockConfidentialTokenConfig = {
  type: 'confidential',
  icon: 'eye-slash',
  title: 'Confidential',
  unique: true,
  token: GlFilteredSearchToken,
  operators: OPERATOR_IS_ONLY,
  options: [
    { icon: 'eye-slash', value: true, title: 'Yes' },
    { icon: 'eye', value: false, title: 'No' },
  ],
};

export const mockEpicTokenConfig = {
  type: 'epic_iid',
  icon: 'epic',
  title: 'Epic',
  unique: true,
  symbol: '&',
  token: EpicToken,
  operators: OPERATOR_IS_ONLY,
850 851 852 853
  idProperty: 'iid',
  useIdValue: true,
  recentSuggestionsStorageKey: 'gitlab-org-epics-recent-tokens-epic_iid',
  fullPath: 'gitlab-org',
854 855 856 857 858 859 860 861
};

export const mockReactionEmojiTokenConfig = {
  type: 'my_reaction_emoji',
  icon: 'thumb-up',
  title: 'My-Reaction',
  unique: true,
  token: EmojiToken,
862
  operators: OPERATOR_IS_AND_IS_NOT,
863 864
  fetchEmojis: expect.any(Function),
};