diff options
Diffstat (limited to 'spec/frontend/batch_comments')
5 files changed, 30 insertions, 22 deletions
diff --git a/spec/frontend/batch_comments/components/draft_note_spec.js b/spec/frontend/batch_comments/components/draft_note_spec.js index ae7134b63c8..c2d488a465e 100644 --- a/spec/frontend/batch_comments/components/draft_note_spec.js +++ b/spec/frontend/batch_comments/components/draft_note_spec.js @@ -1,5 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; import { getByRole } from '@testing-library/dom'; +import { shallowMount, createLocalVue } from '@vue/test-utils'; import DraftNote from '~/batch_comments/components/draft_note.vue'; import { createStore } from '~/batch_comments/stores'; import NoteableNote from '~/notes/components/noteable_note.vue'; @@ -21,14 +21,11 @@ describe('Batch comments draft note component', () => { const getList = () => getByRole(wrapper.element, 'list'); - const createComponent = (propsData = { draft }, features = {}) => { + const createComponent = (propsData = { draft }) => { wrapper = shallowMount(localVue.extend(DraftNote), { store, propsData, localVue, - provide: { - glFeatures: { multilineComments: true, ...features }, - }, }); jest.spyOn(wrapper.vm.$store, 'dispatch').mockImplementation(); @@ -145,16 +142,14 @@ describe('Batch comments draft note component', () => { describe('multiline comments', () => { describe.each` - desc | props | features | event | expectedCalls - ${'with `draft.position`'} | ${draftWithLineRange} | ${{}} | ${'mouseenter'} | ${[['setSelectedCommentPositionHover', LINE_RANGE]]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{}} | ${'mouseleave'} | ${[['setSelectedCommentPositionHover']]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{ multilineComments: false }} | ${'mouseenter'} | ${[]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{ multilineComments: false }} | ${'mouseleave'} | ${[]} - ${'without `draft.position`'} | ${{}} | ${{}} | ${'mouseenter'} | ${[]} - ${'without `draft.position`'} | ${{}} | ${{}} | ${'mouseleave'} | ${[]} - `('$desc and features $features', ({ props, event, features, expectedCalls }) => { + desc | props | event | expectedCalls + ${'with `draft.position`'} | ${draftWithLineRange} | ${'mouseenter'} | ${[['setSelectedCommentPositionHover', LINE_RANGE]]} + ${'with `draft.position`'} | ${draftWithLineRange} | ${'mouseleave'} | ${[['setSelectedCommentPositionHover']]} + ${'without `draft.position`'} | ${{}} | ${'mouseenter'} | ${[]} + ${'without `draft.position`'} | ${{}} | ${'mouseleave'} | ${[]} + `('$desc', ({ props, event, expectedCalls }) => { beforeEach(() => { - createComponent({ draft: { ...draft, ...props } }, features); + createComponent({ draft: { ...draft, ...props } }); jest.spyOn(store, 'dispatch'); }); diff --git a/spec/frontend/batch_comments/components/preview_item_spec.js b/spec/frontend/batch_comments/components/preview_item_spec.js index 173b2710a30..08167a94068 100644 --- a/spec/frontend/batch_comments/components/preview_item_spec.js +++ b/spec/frontend/batch_comments/components/preview_item_spec.js @@ -56,17 +56,30 @@ describe('Batch comments draft preview item component', () => { createComponent(false, { file_path: 'index.js', file_hash: 'abc', - position: { new_line: 1 }, + position: { + line_range: { + start: { + new_line: 1, + type: 'new', + }, + }, + }, }); - expect(vm.$el.querySelector('.bold').textContent).toContain(':1'); + expect(vm.$el.querySelector('.bold').textContent).toContain(':+1'); }); it('renders old line position', () => { createComponent(false, { file_path: 'index.js', file_hash: 'abc', - position: { old_line: 2 }, + position: { + line_range: { + start: { + old_line: 2, + }, + }, + }, }); expect(vm.$el.querySelector('.bold').textContent).toContain(':2'); diff --git a/spec/frontend/batch_comments/components/publish_dropdown_spec.js b/spec/frontend/batch_comments/components/publish_dropdown_spec.js index f235867f002..bd8091c20e0 100644 --- a/spec/frontend/batch_comments/components/publish_dropdown_spec.js +++ b/spec/frontend/batch_comments/components/publish_dropdown_spec.js @@ -1,6 +1,6 @@ -import Vuex from 'vuex'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; +import { shallowMount, createLocalVue } from '@vue/test-utils'; +import Vuex from 'vuex'; import PreviewDropdown from '~/batch_comments/components/preview_dropdown.vue'; import { createStore } from '~/mr_notes/stores'; import '~/behaviors/markdown/render_gfm'; diff --git a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js index 3ad131de24e..885e02ef60f 100644 --- a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js +++ b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; -import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'helpers/test_constants'; +import testAction from 'helpers/vuex_action_helper'; import * as actions from '~/batch_comments/stores/modules/batch_comments/actions'; import axios from '~/lib/utils/axios_utils'; diff --git a/spec/frontend/batch_comments/stores/modules/batch_comments/mutations_spec.js b/spec/frontend/batch_comments/stores/modules/batch_comments/mutations_spec.js index 1406f66fd10..fe01de638c2 100644 --- a/spec/frontend/batch_comments/stores/modules/batch_comments/mutations_spec.js +++ b/spec/frontend/batch_comments/stores/modules/batch_comments/mutations_spec.js @@ -1,6 +1,6 @@ -import createState from '~/batch_comments/stores/modules/batch_comments/state'; -import mutations from '~/batch_comments/stores/modules/batch_comments/mutations'; import * as types from '~/batch_comments/stores/modules/batch_comments/mutation_types'; +import mutations from '~/batch_comments/stores/modules/batch_comments/mutations'; +import createState from '~/batch_comments/stores/modules/batch_comments/state'; describe('Batch comments mutations', () => { let state; |