diff options
Diffstat (limited to 'spec/frontend/packages/details')
9 files changed, 37 insertions, 72 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 }, [], [], () => { |