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

show_ml_model_component_spec.rb « ml « projects « components « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7d08b90791b02036ba8632158969d89f82e0fc83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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