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

observability_helper_spec.rb « projects « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0f47cdb8be28b9b827b0aa128fbbb00d087b3fe2 (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
31
32
33
34
35
36
37
# frozen_string_literal: true

require 'spec_helper'
require 'json'

RSpec.describe Projects::ObservabilityHelper, type: :helper, feature_category: :tracing do
  include Gitlab::Routing.url_helpers

  let_it_be(:group) { build_stubbed(:group) }
  let_it_be(:project) { build_stubbed(:project, group: group) }

  describe '#observability_tracing_view_model' do
    it 'generates the correct JSON' do
      expected_json = {
        tracingUrl: Gitlab::Observability.tracing_url(project),
        provisioningUrl: Gitlab::Observability.provisioning_url(project),
        oauthUrl: Gitlab::Observability.oauth_url
      }.to_json

      expect(helper.observability_tracing_view_model(project)).to eq(expected_json)
    end
  end

  describe '#observability_tracing_details_model' do
    it 'generates the correct JSON' do
      expected_json = {
        tracingIndexUrl: namespace_project_tracing_index_path(project.group, project),
        traceId: "trace-id",
        tracingUrl: Gitlab::Observability.tracing_url(project),
        provisioningUrl: Gitlab::Observability.provisioning_url(project),
        oauthUrl: Gitlab::Observability.oauth_url
      }.to_json

      expect(helper.observability_tracing_details_model(project, "trace-id")).to eq(expected_json)
    end
  end
end