Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/components/projects/ml/show_ml_model_component_spec.rb')
-rw-r--r--spec/components/projects/ml/show_ml_model_component_spec.rb30
1 files changed, 30 insertions, 0 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
new file mode 100644
index 00000000000..7d08b90791b
--- /dev/null
+++ b/spec/components/projects/ml/show_ml_model_component_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+RSpec.describe Projects::Ml::ShowMlModelComponent, type: :component, feature_category: :mlops do
+ let_it_be(:project) { build_stubbed(:project) }
+ let_it_be(:model1) { build_stubbed(:ml_models, :with_latest_version_and_package, project: project) }
+
+ subject(:component) do
+ described_class.new(model: model1)
+ end
+
+ describe 'rendered' do
+ before do
+ render_inline component
+ end
+
+ it 'renders element with view_model' do
+ element = page.find("#js-mount-show-ml-model")
+
+ expect(Gitlab::Json.parse(element['data-view-model'])).to eq({
+ 'model' => {
+ 'id' => model1.id,
+ 'name' => model1.name,
+ 'path' => "/#{project.full_path}/-/ml/models/#{model1.id}"
+ }
+ })
+ end
+ end
+end