diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/frontend/releases | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/frontend/releases')
-rw-r--r-- | spec/frontend/releases/components/app_new_spec.js | 26 | ||||
-rw-r--r-- | spec/frontend/releases/components/release_block_assets_spec.js | 32 |
2 files changed, 57 insertions, 1 deletions
diff --git a/spec/frontend/releases/components/app_new_spec.js b/spec/frontend/releases/components/app_new_spec.js new file mode 100644 index 00000000000..0d5664766e5 --- /dev/null +++ b/spec/frontend/releases/components/app_new_spec.js @@ -0,0 +1,26 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; +import { mount } from '@vue/test-utils'; +import ReleaseNewApp from '~/releases/components/app_new.vue'; + +Vue.use(Vuex); + +describe('Release new component', () => { + let wrapper; + + const factory = () => { + const store = new Vuex.Store(); + wrapper = mount(ReleaseNewApp, { store }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + it('renders the app', () => { + factory(); + + expect(wrapper.exists()).toBe(true); + }); +}); diff --git a/spec/frontend/releases/components/release_block_assets_spec.js b/spec/frontend/releases/components/release_block_assets_spec.js index 44b190b0d19..a85532a8118 100644 --- a/spec/frontend/releases/components/release_block_assets_spec.js +++ b/spec/frontend/releases/components/release_block_assets_spec.js @@ -4,6 +4,7 @@ import ReleaseBlockAssets from '~/releases/components/release_block_assets.vue'; import { ASSET_LINK_TYPE } from '~/releases/constants'; import { trimText } from 'helpers/text_helper'; import { assets } from '../mock_data'; +import { cloneDeep } from 'lodash'; describe('Release block assets', () => { let wrapper; @@ -30,7 +31,7 @@ describe('Release block assets', () => { wrapper.findAll('h5').filter(h5 => h5.text() === sections[type]); beforeEach(() => { - defaultProps = { assets }; + defaultProps = { assets: cloneDeep(assets) }; }); describe('with default props', () => { @@ -96,6 +97,35 @@ describe('Release block assets', () => { }); }); + describe('sources', () => { + const testSources = ({ shouldSourcesBeRendered }) => { + assets.sources.forEach(s => { + expect(wrapper.find(`a[href="${s.url}"]`).exists()).toBe(shouldSourcesBeRendered); + }); + }; + + describe('when the release has sources', () => { + beforeEach(() => { + createComponent(defaultProps); + }); + + it('renders sources', () => { + testSources({ shouldSourcesBeRendered: true }); + }); + }); + + describe('when the release does not have sources', () => { + beforeEach(() => { + delete defaultProps.assets.sources; + createComponent(defaultProps); + }); + + it('does not render any sources', () => { + testSources({ shouldSourcesBeRendered: false }); + }); + }); + }); + describe('external vs internal links', () => { const containsExternalSourceIndicator = () => wrapper.contains('[data-testid="external-link-indicator"]'); |