diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/frontend/repository/components/blob_viewers/download_viewer_spec.js | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/frontend/repository/components/blob_viewers/download_viewer_spec.js')
-rw-r--r-- | spec/frontend/repository/components/blob_viewers/download_viewer_spec.js | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/spec/frontend/repository/components/blob_viewers/download_viewer_spec.js b/spec/frontend/repository/components/blob_viewers/download_viewer_spec.js index c71b2b3c55c..5fe25ced302 100644 --- a/spec/frontend/repository/components/blob_viewers/download_viewer_spec.js +++ b/spec/frontend/repository/components/blob_viewers/download_viewer_spec.js @@ -6,42 +6,33 @@ import DownloadViewer from '~/repository/components/blob_viewers/download_viewer describe('Text Viewer', () => { let wrapper; - const DEFAULT_PROPS = { - fileName: 'file_name.js', - filePath: '/some/file/path', - fileSize: 2269674, + const DEFAULT_BLOB_DATA = { + name: 'file_name.js', + rawPath: '/some/file/path', + rawSize: 2269674, }; - const createComponent = (props = {}) => { + const createComponent = (blobData = {}) => { wrapper = shallowMount(DownloadViewer, { propsData: { - ...DEFAULT_PROPS, - ...props, + blob: { + ...DEFAULT_BLOB_DATA, + ...blobData, + }, }, }); }; - it('renders component', () => { - createComponent(); - - const { fileName, filePath, fileSize } = DEFAULT_PROPS; - expect(wrapper.props()).toMatchObject({ - fileName, - filePath, - fileSize, - }); - }); - it('renders download human readable file size text', () => { createComponent(); - const downloadText = `Download (${numberToHumanSize(DEFAULT_PROPS.fileSize)})`; + const downloadText = `Download (${numberToHumanSize(DEFAULT_BLOB_DATA.rawSize)})`; expect(wrapper.text()).toBe(downloadText); }); it('renders download text', () => { createComponent({ - fileSize: 0, + rawSize: 0, }); expect(wrapper.text()).toBe('Download'); @@ -49,13 +40,13 @@ describe('Text Viewer', () => { it('renders download link', () => { createComponent(); - const { filePath, fileName } = DEFAULT_PROPS; + const { rawPath, name } = DEFAULT_BLOB_DATA; expect(wrapper.findComponent(GlLink).attributes()).toMatchObject({ rel: 'nofollow', target: '_blank', - href: filePath, - download: fileName, + href: rawPath, + download: name, }); }); |