Sha256: 3fe8603445469dc13c749811cc58f4a66968c502cc320c7ecaeb02c209bbd36c

Contents?: true

Size: 1.38 KB

Versions: 17

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

RSpec.describe Qa::LinkedData::PerformanceDataService do
  let(:request) { double }

  describe '.performance_data' do
    context 'when all data passed in' do
      let(:access_time_s) { 0.5 }
      let(:normalize_time_s) { 0.3 }
      let(:graph) { instance_double(RDF::Graph) }
      let(:results) { instance_double(Hash) }

      let(:fetched_size) { 1086 }
      let(:normalized_size) { 1024 }

      before do
        # rubocop:disable RSpec/MessageChain
        allow(results).to receive_message_chain(:to_s, :size).and_return(normalized_size)
        allow(graph).to receive_message_chain(:triples, :to_s, :size).and_return(fetched_size)
        # rubocop:enable RSpec/MessageChain
      end
      it 'uses passed in params' do
        expected_results =
          {
            fetch_time_s: access_time_s,
            normalization_time_s: normalize_time_s,
            fetched_bytes: fetched_size,
            normalized_bytes: normalized_size,
            fetch_bytes_per_s: (fetched_size / access_time_s),
            normalization_bytes_per_s: (normalized_size / normalize_time_s),
            total_time_s: (access_time_s + normalize_time_s)
          }
        expect(described_class.performance_data(access_time_s: access_time_s, normalize_time_s: normalize_time_s, fetched_data_graph: graph, normalized_data: results)).to eq expected_results
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
qa-5.13.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.12.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.11.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.10.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.9.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.8.1 spec/services/linked_data/performance_data_service_spec.rb
qa-5.8.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.7.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.6.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.5.2 spec/services/linked_data/performance_data_service_spec.rb
qa-5.5.1 spec/services/linked_data/performance_data_service_spec.rb
qa-5.5.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.4.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.3.1 spec/services/linked_data/performance_data_service_spec.rb
qa-5.3.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.2.0 spec/services/linked_data/performance_data_service_spec.rb
qa-5.1.0 spec/services/linked_data/performance_data_service_spec.rb