diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 16:05:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 16:05:49 +0000 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/frontend/saved_replies/components | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) | |
download | gitlab-ce-0f94cf6ca9d272d8e0fda4a7a597866cf3dc1fc0.tar.gz |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc4216-0-stable
Diffstat (limited to 'spec/frontend/saved_replies/components')
3 files changed, 0 insertions, 111 deletions
diff --git a/spec/frontend/saved_replies/components/__snapshots__/list_item_spec.js.snap b/spec/frontend/saved_replies/components/__snapshots__/list_item_spec.js.snap deleted file mode 100644 index 3abdfcdaf20..00000000000 --- a/spec/frontend/saved_replies/components/__snapshots__/list_item_spec.js.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Saved replies list item component renders list item 1`] = ` -<li - class="gl-mb-5" -> - <div - class="gl-display-flex gl-align-items-center" - > - <strong> - test - </strong> - </div> - - <div - class="gl-mt-3 gl-font-monospace" - > - /assign_reviewer - </div> -</li> -`; diff --git a/spec/frontend/saved_replies/components/list_item_spec.js b/spec/frontend/saved_replies/components/list_item_spec.js deleted file mode 100644 index cad1000473b..00000000000 --- a/spec/frontend/saved_replies/components/list_item_spec.js +++ /dev/null @@ -1,22 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import ListItem from '~/saved_replies/components/list_item.vue'; - -let wrapper; - -function createComponent(propsData = {}) { - return shallowMount(ListItem, { - propsData, - }); -} - -describe('Saved replies list item component', () => { - afterEach(() => { - wrapper.destroy(); - }); - - it('renders list item', async () => { - wrapper = createComponent({ reply: { name: 'test', content: '/assign_reviewer' } }); - - expect(wrapper.element).toMatchSnapshot(); - }); -}); diff --git a/spec/frontend/saved_replies/components/list_spec.js b/spec/frontend/saved_replies/components/list_spec.js deleted file mode 100644 index 66e9ddfe148..00000000000 --- a/spec/frontend/saved_replies/components/list_spec.js +++ /dev/null @@ -1,68 +0,0 @@ -import Vue from 'vue'; -import { mount } from '@vue/test-utils'; -import VueApollo from 'vue-apollo'; -import noSavedRepliesResponse from 'test_fixtures/graphql/saved_replies/saved_replies_empty.query.graphql.json'; -import savedRepliesResponse from 'test_fixtures/graphql/saved_replies/saved_replies.query.graphql.json'; -import createMockApollo from 'helpers/mock_apollo_helper'; -import waitForPromises from 'helpers/wait_for_promises'; -import List from '~/saved_replies/components/list.vue'; -import ListItem from '~/saved_replies/components/list_item.vue'; -import savedRepliesQuery from '~/saved_replies/queries/saved_replies.query.graphql'; - -let wrapper; - -function createMockApolloProvider(response) { - Vue.use(VueApollo); - - const requestHandlers = [[savedRepliesQuery, jest.fn().mockResolvedValue(response)]]; - - return createMockApollo(requestHandlers); -} - -function createComponent(options = {}) { - const { mockApollo } = options; - - return mount(List, { - apolloProvider: mockApollo, - }); -} - -describe('Saved replies list component', () => { - afterEach(() => { - wrapper.destroy(); - }); - - it('does not render any list items when response is empty', async () => { - const mockApollo = createMockApolloProvider(noSavedRepliesResponse); - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); - - expect(wrapper.findAllComponents(ListItem).length).toBe(0); - }); - - it('render saved replies count', async () => { - const mockApollo = createMockApolloProvider(savedRepliesResponse); - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); - - expect(wrapper.find('[data-testid="title"]').text()).toEqual('My saved replies (2)'); - }); - - it('renders list of saved replies', async () => { - const mockApollo = createMockApolloProvider(savedRepliesResponse); - const savedReplies = savedRepliesResponse.data.currentUser.savedReplies.nodes; - wrapper = createComponent({ mockApollo }); - - await waitForPromises(); - - expect(wrapper.findAllComponents(ListItem).length).toBe(2); - expect(wrapper.findAllComponents(ListItem).at(0).props('reply')).toEqual( - expect.objectContaining(savedReplies[0]), - ); - expect(wrapper.findAllComponents(ListItem).at(1).props('reply')).toEqual( - expect.objectContaining(savedReplies[1]), - ); - }); -}); |