diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-28 03:10:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-28 03:10:52 +0300 |
commit | 2a9fda3873be76cc9295d663e6157a071f2f882c (patch) | |
tree | 4743b51996f8f5de618044cb14ab6778676b0dab /spec | |
parent | d099cb5be9c4fa93ba9a114d11ba6dbe5f10a4eb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/components/projects/ml/show_ml_model_component_spec.rb | 1 | ||||
-rw-r--r-- | spec/frontend/ml/model_registry/apps/show_ml_model_spec.js | 11 | ||||
-rw-r--r-- | spec/frontend/ml/model_registry/mock_data.js | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/spec/components/projects/ml/show_ml_model_component_spec.rb b/spec/components/projects/ml/show_ml_model_component_spec.rb index 34b8cbe96ca..d12692ca792 100644 --- a/spec/components/projects/ml/show_ml_model_component_spec.rb +++ b/spec/components/projects/ml/show_ml_model_component_spec.rb @@ -35,6 +35,7 @@ RSpec.describe Projects::Ml::ShowMlModelComponent, type: :component, feature_cat 'latestVersion' => { 'version' => model1.latest_version.version, 'description' => model1.latest_version.description, + 'path' => "/#{project.full_path}/-/ml/models/#{model1.id}/versions/#{model1.latest_version.id}", 'projectPath' => "/#{project.full_path}", 'packageId' => model1.latest_version.package_id, 'candidate' => { diff --git a/spec/frontend/ml/model_registry/apps/show_ml_model_spec.js b/spec/frontend/ml/model_registry/apps/show_ml_model_spec.js index 1fe0f5f88b3..7e991687496 100644 --- a/spec/frontend/ml/model_registry/apps/show_ml_model_spec.js +++ b/spec/frontend/ml/model_registry/apps/show_ml_model_spec.js @@ -1,7 +1,7 @@ import { GlBadge, GlTab } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { ShowMlModel } from '~/ml/model_registry/apps'; import ModelVersionList from '~/ml/model_registry/components/model_version_list.vue'; import CandidateList from '~/ml/model_registry/components/candidate_list.vue'; @@ -19,7 +19,7 @@ let wrapper; Vue.use(VueApollo); const createWrapper = (model = MODEL) => { - wrapper = shallowMount(ShowMlModel, { + wrapper = shallowMountExtended(ShowMlModel, { apolloProvider, propsData: { model }, stubs: { GlTab }, @@ -37,6 +37,7 @@ const findCandidatesCountBadge = () => findCandidateTab().findComponent(GlBadge) const findTitleArea = () => wrapper.findComponent(TitleArea); const findEmptyState = () => wrapper.findComponent(EmptyState); const findVersionCountMetadataItem = () => findTitleArea().findComponent(MetadataItem); +const findVersionLink = () => wrapper.findByTestId('model-version-link'); describe('ShowMlModel', () => { describe('Title', () => { @@ -67,8 +68,10 @@ describe('ShowMlModel', () => { expect(findModelVersionDetail().props('modelVersion')).toBe(MODEL.latestVersion); }); - it('displays the title', () => { - expect(findDetailTab().text()).toContain('Latest version: 1.2.3'); + it('displays a link to latest version', () => { + expect(findDetailTab().text()).toContain('Latest version:'); + expect(findVersionLink().attributes('href')).toBe(MODEL.latestVersion.path); + expect(findVersionLink().text()).toBe('1.2.3'); }); }); diff --git a/spec/frontend/ml/model_registry/mock_data.js b/spec/frontend/ml/model_registry/mock_data.js index 4399df38990..d8bb6a8eedb 100644 --- a/spec/frontend/ml/model_registry/mock_data.js +++ b/spec/frontend/ml/model_registry/mock_data.js @@ -42,6 +42,7 @@ export const newCandidate = () => ({ const LATEST_VERSION = { version: '1.2.3', + path: 'path/to/modelversion', }; export const makeModel = ({ latestVersion } = { latestVersion: LATEST_VERSION }) => ({ |