diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 00:11:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 00:11:14 +0300 |
commit | 0fd6206b8f54a122743dc993d31db31bc2ddac5d (patch) | |
tree | f3f5d4570b95e76a48d34f59c65e8c20653a0367 /spec/frontend | |
parent | 962b96e640834c04a729f7478afa48d3dedf9fca (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
14 files changed, 89 insertions, 20 deletions
diff --git a/spec/frontend/ci/common/pipelines_table_spec.js b/spec/frontend/ci/common/pipelines_table_spec.js index 47518a9dcce..6cf391d72ca 100644 --- a/spec/frontend/ci/common/pipelines_table_spec.js +++ b/spec/frontend/ci/common/pipelines_table_spec.js @@ -195,7 +195,7 @@ describe('Pipelines Table', () => { it('passes the expected props', () => { expect(findPipelineFailureWidget().props()).toStrictEqual({ - failedJobsCount: firstPipeline.failed_builds.length, + failedJobsCount: firstPipeline.failed_builds_count, isPipelineActive: firstPipeline.active, pipelineIid: firstPipeline.iid, pipelinePath: firstPipeline.path, diff --git a/spec/frontend/diffs/utils/sort_errors_by_file_spec.js b/spec/frontend/diffs/utils/sort_errors_by_file_spec.js new file mode 100644 index 00000000000..ca8a8ec3516 --- /dev/null +++ b/spec/frontend/diffs/utils/sort_errors_by_file_spec.js @@ -0,0 +1,52 @@ +import { sortFindingsByFile } from '~/diffs/utils/sort_findings_by_file'; + +describe('sort_findings_by_file utilities', () => { + const mockDescription = 'mockDescription'; + const mockSeverity = 'mockseverity'; + const mockLine = '00'; + const mockFile1 = 'file1.js'; + const mockFile2 = 'file2.rb'; + const emptyResponse = { + files: {}, + }; + + const unsortedFindings = [ + { + severity: mockSeverity, + filePath: mockFile1, + line: mockLine, + description: mockDescription, + }, + { + severity: mockSeverity, + filePath: mockFile2, + line: mockLine, + description: mockDescription, + }, + ]; + const sortedFindings = { + files: { + [mockFile1]: [ + { + line: mockLine, + description: mockDescription, + severity: mockSeverity, + }, + ], + [mockFile2]: [ + { + line: mockLine, + description: mockDescription, + severity: mockSeverity, + }, + ], + }, + }; + + it('sorts Findings correctly', () => { + expect(sortFindingsByFile(unsortedFindings)).toEqual(sortedFindings); + }); + it('does not throw error when given no input', () => { + expect(sortFindingsByFile()).toEqual(emptyResponse); + }); +}); diff --git a/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js b/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js index 39b480b295c..b2477e9b41c 100644 --- a/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js +++ b/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js @@ -22,6 +22,7 @@ describe('Sidebar Todo Widget', () => { const createComponent = ({ todosQueryHandler = jest.fn().mockResolvedValue(noTodosResponse), + provide = {}, } = {}) => { fakeApollo = createMockApollo([[epicTodoQuery, todosQueryHandler]]); @@ -30,6 +31,7 @@ describe('Sidebar Todo Widget', () => { provide: { canUpdate: true, isClassicSidebar: true, + ...provide, }, propsData: { fullPath: 'group', @@ -122,4 +124,23 @@ describe('Sidebar Todo Widget', () => { expect(wrapper.emitted('todoUpdated')).toEqual([[false]]); }); }); + + describe('when the query is pending', () => { + it('is in the loading state', () => { + createComponent(); + + expect(findTodoButton().attributes('loading')).toBe('true'); + }); + + it('is not in the loading state if notificationsTodosButtons and movedMrSidebar feature flags are enabled', () => { + createComponent({ + provide: { + glFeatures: { notificationsTodosButtons: true, movedMrSidebar: true }, + }, + }); + + expect(findTodoButton().attributes('loading')).toBeUndefined(); + expect(findTodoButton().attributes('disabled')).toBe('true'); + }); + }); }); diff --git a/spec/frontend/work_items/components/work_item_actions_spec.js b/spec/frontend/work_items/components/work_item_actions_spec.js index 0e2af680054..15c33bf5b1e 100644 --- a/spec/frontend/work_items/components/work_item_actions_spec.js +++ b/spec/frontend/work_items/components/work_item_actions_spec.js @@ -38,7 +38,6 @@ describe('WorkItemActions component', () => { let wrapper; const mockWorkItemReference = 'gitlab-org/gitlab-test#1'; - const mockFullPath = 'gitlab-org/gitlab-test'; const mockWorkItemCreateNoteEmail = 'gitlab-incoming+gitlab-org-gitlab-test-2-ddpzuq0zd2wefzofcpcdr3dg7-issue-1@gmail.com'; @@ -109,6 +108,7 @@ describe('WorkItemActions component', () => { [updateWorkItemNotificationsMutation, notificationsMutationHandler], ]), propsData: { + fullPath: 'gitlab-org/gitlab-test', workItemId: 'gid://gitlab/WorkItem/1', canUpdate, canDelete, @@ -120,7 +120,6 @@ describe('WorkItemActions component', () => { workItemCreateNoteEmail, }, provide: { - fullPath: mockFullPath, isGroup: false, glFeatures: { workItemsMvc2: true }, }, diff --git a/spec/frontend/work_items/components/work_item_assignees_spec.js b/spec/frontend/work_items/components/work_item_assignees_spec.js index 972dd4a13fd..196e19791df 100644 --- a/spec/frontend/work_items/components/work_item_assignees_spec.js +++ b/spec/frontend/work_items/components/work_item_assignees_spec.js @@ -90,11 +90,11 @@ describe('WorkItemAssignees component', () => { wrapper = mountExtended(WorkItemAssignees, { provide: { - fullPath: 'test-project-path', isGroup, }, propsData: { assignees, + fullPath: 'test-project-path', workItemId, allowsMultipleAssignees, workItemType: TASK_TYPE_NAME, diff --git a/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js b/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js index 8b7e04854af..123cf647674 100644 --- a/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js +++ b/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js @@ -20,6 +20,7 @@ describe('WorkItemAttributesWrapper component', () => { const createComponent = ({ workItem = workItemQueryResponse.data.workItem } = {}) => { wrapper = shallowMount(WorkItemAttributesWrapper, { propsData: { + fullPath: 'group/project', workItem, }, provide: { @@ -28,7 +29,6 @@ describe('WorkItemAttributesWrapper component', () => { hasOkrsFeature: true, hasIssuableHealthStatusFeature: true, projectNamespace: 'namespace', - fullPath: 'group/project', }, stubs: { WorkItemWeight: true, diff --git a/spec/frontend/work_items/components/work_item_created_updated_spec.js b/spec/frontend/work_items/components/work_item_created_updated_spec.js index e4da5a68a82..3f14615e173 100644 --- a/spec/frontend/work_items/components/work_item_created_updated_spec.js +++ b/spec/frontend/work_items/components/work_item_created_updated_spec.js @@ -54,10 +54,13 @@ describe('WorkItemCreatedUpdated component', () => { [groupWorkItemByIidQuery, groupSuccessHandler], ]), provide: { - fullPath: '/some/project', isGroup, }, - propsData: { workItemIid, updateInProgress }, + propsData: { + fullPath: '/some/project', + workItemIid, + updateInProgress, + }, stubs: { GlAvatarLink, GlSprintf, diff --git a/spec/frontend/work_items/components/work_item_description_spec.js b/spec/frontend/work_items/components/work_item_description_spec.js index 98df0dc1627..de2895591dd 100644 --- a/spec/frontend/work_items/components/work_item_description_spec.js +++ b/spec/frontend/work_items/components/work_item_description_spec.js @@ -70,11 +70,11 @@ describe('WorkItemDescription', () => { [updateWorkItemMutation, mutationHandler], ]), propsData: { + fullPath: 'test-project-path', workItemId: id, workItemIid, }, provide: { - fullPath: 'test-project-path', isGroup, }, }); diff --git a/spec/frontend/work_items/components/work_item_labels_spec.js b/spec/frontend/work_items/components/work_item_labels_spec.js index 1e173776c68..28aa7ffa1be 100644 --- a/spec/frontend/work_items/components/work_item_labels_spec.js +++ b/spec/frontend/work_items/components/work_item_labels_spec.js @@ -59,10 +59,10 @@ describe('WorkItemLabels component', () => { [updateWorkItemMutation, updateWorkItemMutationHandler], ]), provide: { - fullPath: 'test-project-path', isGroup, }, propsData: { + fullPath: 'test-project-path', workItemId, workItemIid, canUpdate, diff --git a/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js index be44ff7b7d9..0147b199040 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_children_wrapper_spec.js @@ -53,10 +53,10 @@ describe('WorkItemChildrenWrapper', () => { wrapper = shallowMountExtended(WorkItemChildrenWrapper, { apolloProvider: mockApollo, provide: { - fullPath: 'test/project', isGroup: false, }, propsData: { + fullPath: 'test/project', workItemType, workItemId: 'gid://gitlab/WorkItem/515', workItemIid: '1', diff --git a/spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js index fd068d3dd40..0a9da17d284 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js @@ -54,6 +54,7 @@ describe('WorkItemLinksForm', () => { [createWorkItemMutation, createMutationResolver], ]), propsData: { + fullPath: 'project/path', issuableGid: 'gid://gitlab/WorkItem/1', parentConfidential, parentIteration, @@ -62,7 +63,6 @@ describe('WorkItemLinksForm', () => { formType, }, provide: { - fullPath: 'project/path', hasIterationsFeature, isGroup: false, }, diff --git a/spec/frontend/work_items/components/work_item_links/work_item_tree_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_tree_spec.js index 01fa4591cde..f30fded0b45 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_tree_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_tree_spec.js @@ -29,10 +29,8 @@ describe('WorkItemTree', () => { canUpdate = true, } = {}) => { wrapper = shallowMountExtended(WorkItemTree, { - provide: { - fullPath: 'test/project', - }, propsData: { + fullPath: 'test/project', workItemType, parentWorkItemType, workItemId: 'gid://gitlab/WorkItem/515', diff --git a/spec/frontend/work_items/components/work_item_milestone_spec.js b/spec/frontend/work_items/components/work_item_milestone_spec.js index c42c9a573e5..e303ad4b481 100644 --- a/spec/frontend/work_items/components/work_item_milestone_spec.js +++ b/spec/frontend/work_items/components/work_item_milestone_spec.js @@ -66,10 +66,8 @@ describe('WorkItemMilestone component', () => { [projectMilestonesQuery, searchQueryHandler], [updateWorkItemMutation, mutationHandler], ]), - provide: { - fullPath: 'full-path', - }, propsData: { + fullPath: 'full-path', canUpdate, workItemMilestone: milestone, workItemId, diff --git a/spec/frontend/work_items/components/work_item_notes_spec.js b/spec/frontend/work_items/components/work_item_notes_spec.js index 35f01c85ec8..9e02e0708d4 100644 --- a/spec/frontend/work_items/components/work_item_notes_spec.js +++ b/spec/frontend/work_items/components/work_item_notes_spec.js @@ -98,10 +98,8 @@ describe('WorkItemNotes component', () => { [workItemNoteUpdatedSubscription, notesUpdateSubscriptionHandler], [workItemNoteDeletedSubscription, notesDeleteSubscriptionHandler], ]), - provide: { - fullPath: 'test-path', - }, propsData: { + fullPath: 'test-path', workItemId, workItemIid, workItemType: 'task', |