2019-12-06 04:06:39 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe SentryErrorPresenter do
|
2021-08-03 23:09:14 -04:00
|
|
|
let(:error) { build(:error_tracking_sentry_detailed_error) }
|
2019-12-06 04:06:39 -05:00
|
|
|
let(:presenter) { described_class.new(error) }
|
|
|
|
|
|
|
|
describe '#frequency' do
|
|
|
|
subject { presenter.frequency }
|
|
|
|
|
|
|
|
it 'returns an array of frequency structs' do
|
2020-01-29 07:09:08 -05:00
|
|
|
expect(subject).to include(a_kind_of(SentryErrorPresenter::FrequencyStruct))
|
2019-12-06 04:06:39 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'converts the times into UTC time objects' do
|
|
|
|
time = subject.first.time
|
|
|
|
|
|
|
|
expect(time).to be_a(Time)
|
|
|
|
expect(time.strftime('%z')).to eq '+0000'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the correct counts' do
|
|
|
|
count = subject.first.count
|
|
|
|
|
|
|
|
expect(count).to eq error.frequency.first[1]
|
|
|
|
end
|
|
|
|
end
|
2020-09-21 05:09:29 -04:00
|
|
|
|
|
|
|
describe '#project_id' do
|
|
|
|
subject { presenter.project_id }
|
|
|
|
|
|
|
|
it 'returns a global ID of the correct type' do
|
|
|
|
expect(subject).to eq(Gitlab::GlobalId.build(model_name: 'SentryProject', id: error.project_id).to_s)
|
|
|
|
end
|
|
|
|
end
|
2019-12-06 04:06:39 -05:00
|
|
|
end
|