diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/frontend/packages | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/frontend/packages')
15 files changed, 73 insertions, 110 deletions
diff --git a/spec/frontend/packages/details/components/__snapshots__/package_title_spec.js.snap b/spec/frontend/packages/details/components/__snapshots__/package_title_spec.js.snap index d317264bdae..318cea98b92 100644 --- a/spec/frontend/packages/details/components/__snapshots__/package_title_spec.js.snap +++ b/spec/frontend/packages/details/components/__snapshots__/package_title_spec.js.snap @@ -9,7 +9,7 @@ exports[`PackageTitle renders with tags 1`] = ` class="gl-display-flex gl-justify-content-space-between gl-py-3" > <div - class="gl-flex-direction-column" + class="gl-flex-direction-column gl-flex-grow-1" > <div class="gl-display-flex" @@ -54,6 +54,7 @@ exports[`PackageTitle renders with tags 1`] = ` link="" size="s" text="maven" + texttooltip="" /> </div> <div @@ -65,6 +66,7 @@ exports[`PackageTitle renders with tags 1`] = ` link="" size="s" text="300 bytes" + texttooltip="" /> </div> <div @@ -95,7 +97,7 @@ exports[`PackageTitle renders without tags 1`] = ` class="gl-display-flex gl-justify-content-space-between gl-py-3" > <div - class="gl-flex-direction-column" + class="gl-flex-direction-column gl-flex-grow-1" > <div class="gl-display-flex" @@ -140,6 +142,7 @@ exports[`PackageTitle renders without tags 1`] = ` link="" size="s" text="maven" + texttooltip="" /> </div> <div @@ -151,6 +154,7 @@ exports[`PackageTitle renders without tags 1`] = ` link="" size="s" text="300 bytes" + texttooltip="" /> </div> </div> diff --git a/spec/frontend/packages/details/components/additional_metadata_spec.js b/spec/frontend/packages/details/components/additional_metadata_spec.js index 111e4205abb..8466a630ecb 100644 --- a/spec/frontend/packages/details/components/additional_metadata_spec.js +++ b/spec/frontend/packages/details/components/additional_metadata_spec.js @@ -11,7 +11,7 @@ describe('Package Additional Metadata', () => { packageEntity: { ...mavenPackage }, }; - const mountComponent = props => { + const mountComponent = (props) => { wrapper = shallowMount(component, { propsData: { ...defaultProps, ...props }, stubs: { @@ -33,7 +33,7 @@ describe('Package Additional Metadata', () => { const findConanRecipe = () => wrapper.find('[data-testid="conan-recipe"]'); const findMavenApp = () => wrapper.find('[data-testid="maven-app"]'); const findMavenGroup = () => wrapper.find('[data-testid="maven-group"]'); - const findElementLink = container => container.find(GlLink); + const findElementLink = (container) => container.find(GlLink); it('has the correct title', () => { mountComponent(); diff --git a/spec/frontend/packages/details/components/conan_installation_spec.js b/spec/frontend/packages/details/components/conan_installation_spec.js index c79d1bb50dd..92c1f8e7f4a 100644 --- a/spec/frontend/packages/details/components/conan_installation_spec.js +++ b/spec/frontend/packages/details/components/conan_installation_spec.js @@ -48,21 +48,13 @@ describe('ConanInstallation', () => { describe('installation commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(0) - .props('instruction'), - ).toBe(conanInstallationCommandStr); + expect(findCodeInstructions().at(0).props('instruction')).toBe(conanInstallationCommandStr); }); }); describe('setup commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(1) - .props('instruction'), - ).toBe(conanSetupCommandStr); + expect(findCodeInstructions().at(1).props('instruction')).toBe(conanSetupCommandStr); }); }); }); diff --git a/spec/frontend/packages/details/components/maven_installation_spec.js b/spec/frontend/packages/details/components/maven_installation_spec.js index f301a03a7f3..ff62969e709 100644 --- a/spec/frontend/packages/details/components/maven_installation_spec.js +++ b/spec/frontend/packages/details/components/maven_installation_spec.js @@ -51,11 +51,7 @@ describe('MavenInstallation', () => { describe('installation commands', () => { it('renders the correct xml block', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: xmlCodeBlock, multiline: true, trackingAction: TrackingActions.COPY_MAVEN_XML, @@ -63,11 +59,7 @@ describe('MavenInstallation', () => { }); it('renders the correct maven command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: mavenCommandStr, multiline: false, trackingAction: TrackingActions.COPY_MAVEN_COMMAND, @@ -77,11 +69,7 @@ describe('MavenInstallation', () => { describe('setup commands', () => { it('renders the correct xml block', () => { - expect( - findCodeInstructions() - .at(2) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(2).props()).toMatchObject({ instruction: mavenSetupXml, multiline: true, trackingAction: TrackingActions.COPY_MAVEN_SETUP, diff --git a/spec/frontend/packages/details/components/npm_installation_spec.js b/spec/frontend/packages/details/components/npm_installation_spec.js index 4223a05453c..dd6e62185a9 100644 --- a/spec/frontend/packages/details/components/npm_installation_spec.js +++ b/spec/frontend/packages/details/components/npm_installation_spec.js @@ -47,11 +47,7 @@ describe('NpmInstallation', () => { describe('installation commands', () => { it('renders the correct npm command', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: 'npm i @Test/package', multiline: false, trackingAction: TrackingActions.COPY_NPM_INSTALL_COMMAND, @@ -59,11 +55,7 @@ describe('NpmInstallation', () => { }); it('renders the correct yarn command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: 'yarn add @Test/package', multiline: false, trackingAction: TrackingActions.COPY_YARN_INSTALL_COMMAND, @@ -73,11 +65,7 @@ describe('NpmInstallation', () => { describe('setup commands', () => { it('renders the correct npm command', () => { - expect( - findCodeInstructions() - .at(2) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(2).props()).toMatchObject({ instruction: 'echo @Test:registry=undefined/ >> .npmrc', multiline: false, trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND, @@ -85,11 +73,7 @@ describe('NpmInstallation', () => { }); it('renders the correct yarn command', () => { - expect( - findCodeInstructions() - .at(3) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(3).props()).toMatchObject({ instruction: 'echo \\"@Test:registry\\" \\"undefined/\\" >> .yarnrc', multiline: false, trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND, diff --git a/spec/frontend/packages/details/components/nuget_installation_spec.js b/spec/frontend/packages/details/components/nuget_installation_spec.js index b381d131e94..685d0808dd9 100644 --- a/spec/frontend/packages/details/components/nuget_installation_spec.js +++ b/spec/frontend/packages/details/components/nuget_installation_spec.js @@ -49,11 +49,7 @@ describe('NugetInstallation', () => { describe('installation commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(0) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(0).props()).toMatchObject({ instruction: nugetInstallationCommandStr, trackingAction: TrackingActions.COPY_NUGET_INSTALL_COMMAND, }); @@ -62,11 +58,7 @@ describe('NugetInstallation', () => { describe('setup commands', () => { it('renders the correct command', () => { - expect( - findCodeInstructions() - .at(1) - .props(), - ).toMatchObject({ + expect(findCodeInstructions().at(1).props()).toMatchObject({ instruction: nugetSetupCommandStr, trackingAction: TrackingActions.COPY_NUGET_SETUP_COMMAND, }); diff --git a/spec/frontend/packages/details/components/package_files_spec.js b/spec/frontend/packages/details/components/package_files_spec.js index 813a2170154..9bcf6ed9235 100644 --- a/spec/frontend/packages/details/components/package_files_spec.js +++ b/spec/frontend/packages/details/components/package_files_spec.js @@ -24,7 +24,6 @@ describe('Package Files', () => { stubs: { ...stubChildren(component), GlTable: false, - GlLink: '<div><slot></slot></div>', }, }); }; diff --git a/spec/frontend/packages/details/components/package_history_spec.js b/spec/frontend/packages/details/components/package_history_spec.js index c43ac9b9c40..5a6b386e2ca 100644 --- a/spec/frontend/packages/details/components/package_history_spec.js +++ b/spec/frontend/packages/details/components/package_history_spec.js @@ -15,10 +15,10 @@ describe('Package History', () => { packageEntity: { ...mavenPackage }, }; - const createPipelines = amount => + const createPipelines = (amount) => [...Array(amount)].map((x, index) => ({ ...mockPipelineInfo, id: index + 1 })); - const mountComponent = props => { + const mountComponent = (props) => { wrapper = shallowMount(component, { propsData: { ...defaultProps, ...props }, stubs: { @@ -35,9 +35,9 @@ describe('Package History', () => { wrapper = null; }); - const findHistoryElement = testId => wrapper.find(`[data-testid="${testId}"]`); - const findElementLink = container => container.find(GlLink); - const findElementTimeAgo = container => container.find(TimeAgoTooltip); + const findHistoryElement = (testId) => wrapper.find(`[data-testid="${testId}"]`); + const findElementLink = (container) => container.find(GlLink); + const findElementTimeAgo = (container) => container.find(TimeAgoTooltip); const findTitle = () => wrapper.find('[data-testid="title"]'); const findTimeline = () => wrapper.find('[data-testid="timeline"]'); diff --git a/spec/frontend/packages/details/store/actions_spec.js b/spec/frontend/packages/details/store/actions_spec.js index 70f87d18bcb..e823a00ebc4 100644 --- a/spec/frontend/packages/details/store/actions_spec.js +++ b/spec/frontend/packages/details/store/actions_spec.js @@ -12,7 +12,7 @@ jest.mock('~/api.js'); describe('Actions Package details store', () => { describe('fetchPackageVersions', () => { - it('should fetch the package versions', done => { + it('should fetch the package versions', (done) => { Api.projectPackage = jest.fn().mockResolvedValue({ data: packageEntity }); testAction( @@ -35,14 +35,17 @@ describe('Actions Package details store', () => { ); }); - it("does not set the versions if they don't exist", done => { + it("does not set the versions if they don't exist", (done) => { Api.projectPackage = jest.fn().mockResolvedValue({ data: { packageEntity, versions: null } }); testAction( fetchPackageVersions, undefined, { packageEntity }, - [{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], + [ + { type: types.SET_LOADING, payload: true }, + { type: types.SET_LOADING, payload: false }, + ], [], () => { expect(Api.projectPackage).toHaveBeenCalledWith( @@ -54,14 +57,17 @@ describe('Actions Package details store', () => { ); }); - it('should create flash on API error', done => { + it('should create flash on API error', (done) => { Api.projectPackage = jest.fn().mockRejectedValue(); testAction( fetchPackageVersions, undefined, { packageEntity }, - [{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], + [ + { type: types.SET_LOADING, payload: true }, + { type: types.SET_LOADING, payload: false }, + ], [], () => { expect(Api.projectPackage).toHaveBeenCalledWith( @@ -76,7 +82,7 @@ describe('Actions Package details store', () => { }); describe('deletePackage', () => { - it('should call Api.deleteProjectPackage', done => { + it('should call Api.deleteProjectPackage', (done) => { Api.deleteProjectPackage = jest.fn().mockResolvedValue(); testAction(deletePackage, undefined, { packageEntity }, [], [], () => { expect(Api.deleteProjectPackage).toHaveBeenCalledWith( @@ -86,7 +92,7 @@ describe('Actions Package details store', () => { done(); }); }); - it('should create flash on API error', done => { + it('should create flash on API error', (done) => { Api.deleteProjectPackage = jest.fn().mockRejectedValue(); testAction(deletePackage, undefined, { packageEntity }, [], [], () => { diff --git a/spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap b/spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap index c51130dae00..b2df1ac5ab6 100644 --- a/spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap +++ b/spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap @@ -34,7 +34,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -95,7 +95,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no Composer packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -156,7 +156,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no Conan packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -217,7 +217,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no Generic packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -278,7 +278,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no Maven packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -339,7 +339,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no NPM packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -400,7 +400,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no NuGet packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> @@ -461,7 +461,7 @@ exports[`packages_list_app renders 1`] = ` class="svg-250 svg-content" > <img - alt="There are no PyPI packages yet" + alt="" class="gl-max-w-full" src="helpSvg" /> diff --git a/spec/frontend/packages/list/components/packages_sort_spec.js b/spec/frontend/packages/list/components/packages_sort_spec.js index 5c4794d8f63..d15ad9bd542 100644 --- a/spec/frontend/packages/list/components/packages_sort_spec.js +++ b/spec/frontend/packages/list/components/packages_sort_spec.js @@ -16,7 +16,7 @@ describe('packages_sort', () => { const findPackageListSorting = () => wrapper.find(GlSorting); const findSortingItems = () => wrapper.findAll(GlSortingItem); - const createStore = isGroupPage => { + const createStore = (isGroupPage) => { const state = { config: { isGroupPage, diff --git a/spec/frontend/packages/list/stores/actions_spec.js b/spec/frontend/packages/list/stores/actions_spec.js index cf205ecbac4..05e1fe57cae 100644 --- a/spec/frontend/packages/list/stores/actions_spec.js +++ b/spec/frontend/packages/list/stores/actions_spec.js @@ -30,7 +30,7 @@ describe('Actions Package list store', () => { sort: 'asc', orderBy: 'version', }; - it('should fetch the project packages list when isGroupPage is false', done => { + it('should fetch the project packages list when isGroupPage is false', (done) => { testAction( actions.requestPackagesList, undefined, @@ -50,7 +50,7 @@ describe('Actions Package list store', () => { ); }); - it('should fetch the group packages list when isGroupPage is true', done => { + it('should fetch the group packages list when isGroupPage is true', (done) => { testAction( actions.requestPackagesList, undefined, @@ -70,7 +70,7 @@ describe('Actions Package list store', () => { ); }); - it('should fetch packages of a certain type when selectedType is present', done => { + it('should fetch packages of a certain type when selectedType is present', (done) => { const packageType = 'maven'; testAction( @@ -102,14 +102,17 @@ describe('Actions Package list store', () => { ); }); - it('should create flash on API error', done => { + it('should create flash on API error', (done) => { Api.projectPackages = jest.fn().mockRejectedValue(); testAction( actions.requestPackagesList, undefined, { config: { isGroupPage: false, resourceId: 2 }, sorting }, [], - [{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], + [ + { type: 'setLoading', payload: true }, + { type: 'setLoading', payload: false }, + ], () => { expect(createFlash).toHaveBeenCalled(); done(); @@ -119,7 +122,7 @@ describe('Actions Package list store', () => { }); describe('receivePackagesListSuccess', () => { - it('should set received packages', done => { + it('should set received packages', (done) => { const data = 'foo'; testAction( @@ -137,7 +140,7 @@ describe('Actions Package list store', () => { }); describe('setInitialState', () => { - it('should commit setInitialState', done => { + it('should commit setInitialState', (done) => { testAction( actions.setInitialState, '1', @@ -150,7 +153,7 @@ describe('Actions Package list store', () => { }); describe('setLoading', () => { - it('should commit set main loading', done => { + it('should commit set main loading', (done) => { testAction( actions.setLoading, true, @@ -168,7 +171,7 @@ describe('Actions Package list store', () => { delete_api_path: 'foo', }, }; - it('should perform a delete operation on _links.delete_api_path', done => { + it('should perform a delete operation on _links.delete_api_path', (done) => { mock.onDelete(payload._links.delete_api_path).replyOnce(200); Api.projectPackages = jest.fn().mockResolvedValue({ data: 'foo' }); @@ -185,14 +188,17 @@ describe('Actions Package list store', () => { ); }); - it('should stop the loading and call create flash on api error', done => { + it('should stop the loading and call create flash on api error', (done) => { mock.onDelete(payload._links.delete_api_path).replyOnce(400); testAction( actions.requestDeletePackage, payload, null, [], - [{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], + [ + { type: 'setLoading', payload: true }, + { type: 'setLoading', payload: false }, + ], () => { expect(createFlash).toHaveBeenCalled(); done(); @@ -205,7 +211,7 @@ describe('Actions Package list store', () => { ${'_links'} | ${{}} ${'delete_api_path'} | ${{ _links: {} }} `('should reject and createFlash when $property is missing', ({ actionPayload }, done) => { - testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch(e => { + testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch((e) => { expect(e).toEqual(new Error(MISSING_DELETE_PATH_ERROR)); expect(createFlash).toHaveBeenCalledWith(DELETE_PACKAGE_ERROR_MESSAGE); done(); @@ -214,7 +220,7 @@ describe('Actions Package list store', () => { }); describe('setSorting', () => { - it('should commit SET_SORTING', done => { + it('should commit SET_SORTING', (done) => { testAction( actions.setSorting, 'foo', @@ -227,7 +233,7 @@ describe('Actions Package list store', () => { }); describe('setFilter', () => { - it('should commit SET_FILTER', done => { + it('should commit SET_FILTER', (done) => { testAction( actions.setFilter, 'foo', diff --git a/spec/frontend/packages/shared/components/package_path_spec.js b/spec/frontend/packages/shared/components/package_path_spec.js index 40d455ac77c..3c9cd3387ba 100644 --- a/spec/frontend/packages/shared/components/package_path_spec.js +++ b/spec/frontend/packages/shared/components/package_path_spec.js @@ -21,8 +21,8 @@ describe('PackagePath', () => { const ELLIPSIS_CHEVRON = 'ellipsis-chevron'; const LEAF_LINK = 'leaf-link'; - const findItem = name => wrapper.find(`[data-testid="${name}"]`); - const findTooltip = w => getBinding(w.element, 'gl-tooltip'); + const findItem = (name) => wrapper.find(`[data-testid="${name}"]`); + const findTooltip = (w) => getBinding(w.element, 'gl-tooltip'); afterEach(() => { wrapper.destroy(); @@ -64,13 +64,13 @@ describe('PackagePath', () => { } if (shouldExist.length) { - it.each(shouldExist)(`should have %s`, element => { + it.each(shouldExist)(`should have %s`, (element) => { expect(findItem(element).exists()).toBe(true); }); } if (shouldNotExist.length) { - it.each(shouldNotExist)(`should not have %s`, element => { + it.each(shouldNotExist)(`should not have %s`, (element) => { expect(findItem(element).exists()).toBe(false); }); } diff --git a/spec/frontend/packages/shared/components/package_tags_spec.js b/spec/frontend/packages/shared/components/package_tags_spec.js index cc49a9a9244..d26e4e76b87 100644 --- a/spec/frontend/packages/shared/components/package_tags_spec.js +++ b/spec/frontend/packages/shared/components/package_tags_spec.js @@ -75,11 +75,7 @@ describe('PackageTags', () => { const expectedStyle = [...defaultStyle, 'gl-display-flex', 'gl-ml-3']; - expect( - tagBadges() - .at(0) - .classes(), - ).toEqual(expect.arrayContaining(expectedStyle)); + expect(tagBadges().at(0).classes()).toEqual(expect.arrayContaining(expectedStyle)); }); it('shows tag badge for medium or heigher resolutions', () => { @@ -87,11 +83,7 @@ describe('PackageTags', () => { const expectedStyle = [...defaultStyle, 'd-md-flex']; - expect( - tagBadges() - .at(1) - .classes(), - ).toEqual(expect.arrayContaining(expectedStyle)); + expect(tagBadges().at(1).classes()).toEqual(expect.arrayContaining(expectedStyle)); }); it('correctly prepends left and appends right when there is more than one tag', () => { diff --git a/spec/frontend/packages/shared/utils_spec.js b/spec/frontend/packages/shared/utils_spec.js index 3e4ce8eb323..590e3814bee 100644 --- a/spec/frontend/packages/shared/utils_spec.js +++ b/spec/frontend/packages/shared/utils_spec.js @@ -13,7 +13,7 @@ describe('Packages shared utils', () => { expect(packageTypeToTrackCategory()).toMatchInlineSnapshot(`"UI::undefined"`); }); - it.each(Object.keys(PackageType))('returns a correct category string for %s', packageKey => { + it.each(Object.keys(PackageType))('returns a correct category string for %s', (packageKey) => { const packageName = PackageType[packageKey]; expect(packageTypeToTrackCategory(packageName)).toBe( `UI::${TrackingCategories[packageName]}`, |