diff options
Diffstat (limited to 'spec/frontend')
20 files changed, 34 insertions, 35 deletions
diff --git a/spec/frontend/issues/show/components/incidents/timeline_events_item_spec.js b/spec/frontend/issues/show/components/incidents/timeline_events_item_spec.js index 28223e92ade..1bf8d68efd4 100644 --- a/spec/frontend/issues/show/components/incidents/timeline_events_item_spec.js +++ b/spec/frontend/issues/show/components/incidents/timeline_events_item_spec.js @@ -94,7 +94,7 @@ describe('IncidentTimelineEventList', () => { await nextTick(); - expect(wrapper.emitted().delete).toBeTruthy(); + expect(wrapper.emitted().delete).toHaveLength(1); }); }); }); diff --git a/spec/frontend/jira_connect/branches/components/new_branch_form_spec.js b/spec/frontend/jira_connect/branches/components/new_branch_form_spec.js index b9fed5f34f1..cc8346253ee 100644 --- a/spec/frontend/jira_connect/branches/components/new_branch_form_spec.js +++ b/spec/frontend/jira_connect/branches/components/new_branch_form_spec.js @@ -217,7 +217,7 @@ describe('NewBranchForm', () => { }); it('emits `success` event', () => { - expect(wrapper.emitted('success')).toBeTruthy(); + expect(wrapper.emitted('success')).toHaveLength(1); }); it('called `createBranch` mutation correctly', () => { diff --git a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com_spec.js b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com_spec.js index 1649920b48b..b9a8451f3b3 100644 --- a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com_spec.js +++ b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com_spec.js @@ -101,7 +101,7 @@ describe('SignInGitlabCom', () => { const button = findSignInOauthButton(); button.vm.$emit('error'); - expect(wrapper.emitted('error')).toBeTruthy(); + expect(wrapper.emitted('error')).toHaveLength(1); }); }); }); diff --git a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js index 6b85ca78914..10696d25f17 100644 --- a/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js +++ b/spec/frontend/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index_spec.js @@ -86,7 +86,7 @@ describe('SignInGitlabMultiversion', () => { const button = findSignInOauthButton(); button.vm.$emit('error'); - expect(wrapper.emitted('error')).toBeTruthy(); + expect(wrapper.emitted('error')).toHaveLength(1); }); }); }); diff --git a/spec/frontend/jira_import/components/jira_import_form_spec.js b/spec/frontend/jira_import/components/jira_import_form_spec.js index ca91ce90a02..d43a9f8a145 100644 --- a/spec/frontend/jira_import/components/jira_import_form_spec.js +++ b/spec/frontend/jira_import/components/jira_import_form_spec.js @@ -164,8 +164,9 @@ describe('JiraImportForm', () => { it('shows a heading for the user mapping section', () => { expect( - getByRole(wrapper.element, 'heading', { name: 'Jira-GitLab user mapping template' }), - ).toBeTruthy(); + getByRole(wrapper.element, 'heading', { name: 'Jira-GitLab user mapping template' }) + .innerText, + ).toBe('Jira-GitLab user mapping template'); }); it('shows information to the user', () => { @@ -182,15 +183,15 @@ describe('JiraImportForm', () => { }); it('has a "Jira display name" column', () => { - expect(getHeader('Jira display name')).toBeTruthy(); + expect(getHeader('Jira display name').innerText).toBe('Jira display name'); }); it('has an "arrow" column', () => { - expect(getHeader('Arrow')).toBeTruthy(); + expect(getHeader('Arrow').getAttribute('aria-label')).toBe('Arrow'); }); it('has a "GitLab username" column', () => { - expect(getHeader('GitLab username')).toBeTruthy(); + expect(getHeader('GitLab username').innerText).toBe('GitLab username'); }); }); diff --git a/spec/frontend/lib/utils/poll_spec.js b/spec/frontend/lib/utils/poll_spec.js index 1f150599983..94a5f5385b7 100644 --- a/spec/frontend/lib/utils/poll_spec.js +++ b/spec/frontend/lib/utils/poll_spec.js @@ -128,9 +128,11 @@ describe('Poll', () => { errorCallback: callbacks.error, }); + expect(Polling.timeoutID).toBeNull(); + Polling.makeDelayedRequest(1); - expect(Polling.timeoutID).toBeTruthy(); + expect(Polling.timeoutID).not.toBeNull(); return waitForAllCallsToFinish(2, () => { Polling.stop(); diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js index 6109b40eee2..1de6b6e3e98 100644 --- a/spec/frontend/monitoring/components/dashboard_spec.js +++ b/spec/frontend/monitoring/components/dashboard_spec.js @@ -618,7 +618,7 @@ describe('Dashboard', () => { findRearrangeButton().vm.$emit('click'); await nextTick(); - expect(findRearrangeButton().attributes('pressed')).toBeTruthy(); + expect(findRearrangeButton().attributes('pressed')).toBe('true'); expect(findEnabledDraggables().wrappers).toEqual(findDraggables().wrappers); }); @@ -662,7 +662,7 @@ describe('Dashboard', () => { findRearrangeButton().vm.$emit('click'); await nextTick(); - expect(findRearrangeButton().attributes('pressed')).toBeFalsy(); + expect(findRearrangeButton().attributes('pressed')).toBeUndefined(); expect(findEnabledDraggables().length).toBe(0); }); }); diff --git a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js index 721992e710a..3ccaa2d28ac 100644 --- a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js +++ b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js @@ -163,9 +163,6 @@ describe('DashboardsDropdown', () => { findItemAt(1).vm.$emit('click'); }); - it('emits a "selectDashboard" event', () => { - expect(wrapper.emitted().selectDashboard).toBeTruthy(); - }); it('emits a "selectDashboard" event with dashboard information', () => { expect(wrapper.emitted().selectDashboard[0]).toEqual([dashboardGitResponse[0]]); }); diff --git a/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js b/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js index 755204dc721..b54ca926dae 100644 --- a/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js +++ b/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js @@ -68,7 +68,7 @@ describe('DuplicateDashboardForm', () => { await nextTick(); expect(findByRef('fileNameFormGroup').classes()).toContain('is-invalid'); - expect(findInvalidFeedback().text()).toBeTruthy(); + expect(findInvalidFeedback().text()).toBe('The file name should have a .yml extension'); }); }); diff --git a/spec/frontend/notes/components/discussion_notes_spec.js b/spec/frontend/notes/components/discussion_notes_spec.js index 1b8b6bec490..a74d709ed3a 100644 --- a/spec/frontend/notes/components/discussion_notes_spec.js +++ b/spec/frontend/notes/components/discussion_notes_spec.js @@ -140,21 +140,21 @@ describe('DiscussionNotes', () => { findNoteAtIndex(0).vm.$emit('handleDeleteNote'); await nextTick(); - expect(wrapper.emitted().deleteNote).toBeTruthy(); + expect(wrapper.emitted().deleteNote).toHaveLength(1); }); it('emits startReplying when first note emits startReplying', async () => { findNoteAtIndex(0).vm.$emit('startReplying'); await nextTick(); - expect(wrapper.emitted().startReplying).toBeTruthy(); + expect(wrapper.emitted().startReplying).toHaveLength(1); }); it('emits deleteNote when second note emits handleDeleteNote', async () => { findNoteAtIndex(1).vm.$emit('handleDeleteNote'); await nextTick(); - expect(wrapper.emitted().deleteNote).toBeTruthy(); + expect(wrapper.emitted().deleteNote).toHaveLength(1); }); }); @@ -169,7 +169,7 @@ describe('DiscussionNotes', () => { note.vm.$emit('handleDeleteNote'); await nextTick(); - expect(wrapper.emitted().deleteNote).toBeTruthy(); + expect(wrapper.emitted().deleteNote).toHaveLength(1); }); }); }); diff --git a/spec/frontend/notes/components/multiline_comment_form_spec.js b/spec/frontend/notes/components/multiline_comment_form_spec.js index b027a261c15..8446bba340f 100644 --- a/spec/frontend/notes/components/multiline_comment_form_spec.js +++ b/spec/frontend/notes/components/multiline_comment_form_spec.js @@ -70,7 +70,7 @@ describe('MultilineCommentForm', () => { glSelect.vm.$emit('change', { ...testLine }); expect(wrapper.vm.commentLineStart).toEqual(line); - expect(wrapper.emitted('input')).toBeTruthy(); + expect(wrapper.emitted('input')).toHaveLength(1); // Once during created, once during updateCommentLineStart expect(setSelectedCommentPosition).toHaveBeenCalledTimes(2); }); diff --git a/spec/frontend/notes/stores/getters_spec.js b/spec/frontend/notes/stores/getters_spec.js index 6d078dcefcf..e03fa854e54 100644 --- a/spec/frontend/notes/stores/getters_spec.js +++ b/spec/frontend/notes/stores/getters_spec.js @@ -211,7 +211,7 @@ describe('Getters Notes Store', () => { describe('isNotesFetched', () => { it('should return the state for the fetching notes', () => { - expect(getters.isNotesFetched(state)).toBeFalsy(); + expect(getters.isNotesFetched(state)).toBe(false); }); }); @@ -512,8 +512,8 @@ describe('Getters Notes Store', () => { unresolvedDiscussionsIdsByDate: [], }; - expect(getters.firstUnresolvedDiscussionId(state, localGettersFalsy)(true)).toBeFalsy(); - expect(getters.firstUnresolvedDiscussionId(state, localGettersFalsy)(false)).toBeFalsy(); + expect(getters.firstUnresolvedDiscussionId(state, localGettersFalsy)(true)).toBeUndefined(); + expect(getters.firstUnresolvedDiscussionId(state, localGettersFalsy)(false)).toBeUndefined(); }); }); diff --git a/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js b/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js index 33c76309951..744b0378a75 100644 --- a/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js +++ b/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js @@ -224,7 +224,7 @@ describe('Pipeline Editor | Commit section', () => { }); it('emits a commit event with the right type, sourceBranch and targetBranch', () => { - expect(wrapper.emitted('commit')).toBeTruthy(); + expect(wrapper.emitted('commit')).toHaveLength(1); expect(wrapper.emitted('commit')[0]).toMatchObject([ { type: COMMIT_SUCCESS_WITH_REDIRECT, diff --git a/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js b/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js index 8d172a8462a..b86c82850c5 100644 --- a/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js +++ b/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js @@ -23,7 +23,7 @@ describe('WalkthroughPopover component', () => { }); it('emits "walkthrough-popover-cta-clicked" event', async () => { - expect(wrapper.emitted()['walkthrough-popover-cta-clicked']).toBeTruthy(); + expect(wrapper.emitted()['walkthrough-popover-cta-clicked']).toHaveLength(1); }); }); }); diff --git a/spec/frontend/pipeline_wizard/components/editor_spec.js b/spec/frontend/pipeline_wizard/components/editor_spec.js index b4ddc6e7d42..26e4b8eb0ea 100644 --- a/spec/frontend/pipeline_wizard/components/editor_spec.js +++ b/spec/frontend/pipeline_wizard/components/editor_spec.js @@ -11,7 +11,7 @@ describe('Pages Yaml Editor wrapper', () => { const wrapper = mount(YamlEditor, defaultOptions); it('editor is mounted', () => { - expect(wrapper.vm.editor).not.toBeFalsy(); + expect(wrapper.vm.editor).not.toBeUndefined(); expect(wrapper.find('.gl-source-editor').exists()).toBe(true); }); }); diff --git a/spec/frontend/repository/components/blob_button_group_spec.js b/spec/frontend/repository/components/blob_button_group_spec.js index a00f49ec4f8..33a85c04fcf 100644 --- a/spec/frontend/repository/components/blob_button_group_spec.js +++ b/spec/frontend/repository/components/blob_button_group_spec.js @@ -97,14 +97,14 @@ describe('BlobButtonGroup component', () => { findReplaceButton().trigger('click'); expect(findUploadBlobModal().vm.show).not.toHaveBeenCalled(); - expect(wrapper.emitted().fork).toBeTruthy(); + expect(wrapper.emitted().fork).toHaveLength(1); }); it('does not trigger the DeleteBlobModal from the delete button', () => { findDeleteButton().trigger('click'); expect(findDeleteBlobModal().vm.show).not.toHaveBeenCalled(); - expect(wrapper.emitted().fork).toBeTruthy(); + expect(wrapper.emitted().fork).toHaveLength(1); }); }); }); diff --git a/spec/frontend/repository/components/blob_viewers/csv_viewer_spec.js b/spec/frontend/repository/components/blob_viewers/csv_viewer_spec.js index 7d43e4e660b..c6b9737dde2 100644 --- a/spec/frontend/repository/components/blob_viewers/csv_viewer_spec.js +++ b/spec/frontend/repository/components/blob_viewers/csv_viewer_spec.js @@ -21,7 +21,7 @@ describe('CSV Viewer', () => { it('renders a Source Editor component', () => { createComponent(); expect(findCsvViewerComp().exists()).toBe(true); - expect(findCsvViewerComp().props('remoteFile')).toBeTruthy(); + expect(findCsvViewerComp().props('remoteFile')).toBe(true); expect(findCsvViewerComp().props('csv')).toBe(DEFAULT_BLOB_DATA.rawPath); }); }); diff --git a/spec/frontend/sidebar/assignee_title_spec.js b/spec/frontend/sidebar/assignee_title_spec.js index 3079cb28406..e29e3d489a5 100644 --- a/spec/frontend/sidebar/assignee_title_spec.js +++ b/spec/frontend/sidebar/assignee_title_spec.js @@ -85,7 +85,7 @@ describe('AssigneeTitle component', () => { editable: false, }); - expect(wrapper.find(GlLoadingIcon).exists()).toBeFalsy(); + expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); }); it('renders spinner when loading', () => { @@ -95,7 +95,7 @@ describe('AssigneeTitle component', () => { editable: false, }); - expect(wrapper.find(GlLoadingIcon).exists()).toBeTruthy(); + expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); }); it('does not render edit link when not editable', () => { diff --git a/spec/frontend/sidebar/todo_spec.js b/spec/frontend/sidebar/todo_spec.js index 9316268d2ad..5f696b237e0 100644 --- a/spec/frontend/sidebar/todo_spec.js +++ b/spec/frontend/sidebar/todo_spec.js @@ -55,7 +55,7 @@ describe('SidebarTodo', () => { wrapper.find('button').trigger('click'); await nextTick(); - expect(wrapper.emitted().toggleTodo).toBeTruthy(); + expect(wrapper.emitted().toggleTodo).toHaveLength(1); }); it('renders component container element with proper data attributes', () => { diff --git a/spec/frontend/work_items/components/work_item_detail_spec.js b/spec/frontend/work_items/components/work_item_detail_spec.js index f4ca9215f70..b047e0dc8d7 100644 --- a/spec/frontend/work_items/components/work_item_detail_spec.js +++ b/spec/frontend/work_items/components/work_item_detail_spec.js @@ -313,8 +313,7 @@ describe('WorkItemDetail component', () => { await waitForPromises(); findWorkItemActions().vm.$emit('toggleWorkItemConfidentiality', true); await waitForPromises(); - - expect(wrapper.emitted('workItemUpdated')).toBeFalsy(); + expect(wrapper.emitted('workItemUpdated')).toBeUndefined(); await nextTick(); |