Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/notes/components/notes_app_spec.js')
-rw-r--r--spec/frontend/notes/components/notes_app_spec.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/frontend/notes/components/notes_app_spec.js b/spec/frontend/notes/components/notes_app_spec.js
index 163501d5ce8..241a89b2218 100644
--- a/spec/frontend/notes/components/notes_app_spec.js
+++ b/spec/frontend/notes/components/notes_app_spec.js
@@ -3,6 +3,8 @@ import AxiosMockAdapter from 'axios-mock-adapter';
import $ from 'jquery';
import Vue from 'vue';
import { setTestTimeout } from 'helpers/timeout';
+import DraftNote from '~/batch_comments/components/draft_note.vue';
+import batchComments from '~/batch_comments/stores/modules/batch_comments';
import axios from '~/lib/utils/axios_utils';
import * as urlUtility from '~/lib/utils/url_utility';
import CommentForm from '~/notes/components/comment_form.vue';
@@ -400,4 +402,32 @@ describe('note_app', () => {
expect(getComponentOrder()).toStrictEqual([TYPE_NOTES_LIST, TYPE_COMMENT_FORM]);
});
});
+
+ describe('when multiple draft types are present', () => {
+ beforeEach(() => {
+ store = createStore();
+ store.registerModule('batchComments', batchComments());
+ store.state.batchComments.drafts = [
+ mockData.draftDiffDiscussion,
+ mockData.draftReply,
+ ...mockData.draftComments,
+ ];
+ store.state.isLoading = false;
+ wrapper = shallowMount(NotesApp, {
+ propsData,
+ store,
+ stubs: {
+ OrderedLayout,
+ },
+ });
+ });
+
+ it('correctly finds only draft comments', () => {
+ const drafts = wrapper.findAll(DraftNote).wrappers;
+
+ expect(drafts.map((x) => x.props('draft'))).toEqual(
+ mockData.draftComments.map(({ note }) => expect.objectContaining({ note })),
+ );
+ });
+ });
});