diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js')
-rw-r--r-- | spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js b/spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js deleted file mode 100644 index 8dc71f99010..00000000000 --- a/spec/frontend/blob/suggest_web_ide_ci/web_ide_alert_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -import MockAdapter from 'axios-mock-adapter'; -import waitForPromises from 'helpers/wait_for_promises'; -import { shallowMount } from '@vue/test-utils'; -import { GlButton, GlAlert } from '@gitlab/ui'; -import axios from '~/lib/utils/axios_utils'; -import WebIdeAlert from '~/blob/suggest_web_ide_ci/components/web_ide_alert.vue'; - -const dismissEndpoint = '/-/user_callouts'; -const featureId = 'web_ide_alert_dismissed'; -const editPath = 'edit/master/-/.gitlab-ci.yml'; - -describe('WebIdeAlert', () => { - let wrapper; - let mock; - - const findButton = () => wrapper.find(GlButton); - const findAlert = () => wrapper.find(GlAlert); - const dismissAlert = alertWrapper => alertWrapper.vm.$emit('dismiss'); - const getPostPayload = () => JSON.parse(mock.history.post[0].data); - - const createComponent = () => { - wrapper = shallowMount(WebIdeAlert, { - propsData: { - dismissEndpoint, - featureId, - editPath, - }, - }); - }; - - beforeEach(() => { - mock = new MockAdapter(axios); - - mock.onPost(dismissEndpoint).reply(200); - - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - - mock.restore(); - }); - - describe('with defaults', () => { - it('displays alert correctly', () => { - expect(findAlert().exists()).toBe(true); - }); - - it('web ide button link has correct path', () => { - expect(findButton().attributes('href')).toBe(editPath); - }); - - it('dismisses alert correctly', async () => { - const alertWrapper = findAlert(); - - dismissAlert(alertWrapper); - - await waitForPromises(); - - expect(alertWrapper.exists()).toBe(false); - expect(mock.history.post).toHaveLength(1); - expect(getPostPayload()).toEqual({ feature_name: featureId }); - }); - }); -}); |