-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Automated] Merged master into target k8s
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
modules/check_in/spec/services/check_in/vaos/base_service_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe CheckIn::VAOS::BaseService do | ||
subject { described_class.new(patient_icn:) } | ||
|
||
let(:patient_icn) { '123' } | ||
let(:token) { 'test_token' } | ||
let(:request_id) { SecureRandom.uuid } | ||
|
||
describe '#config' do | ||
it 'returns an instance of Configuration' do | ||
expect(subject.config).to be_an_instance_of(CheckIn::VAOS::Configuration) | ||
end | ||
end | ||
|
||
describe '#headers' do | ||
before do | ||
allow_any_instance_of(CheckIn::Map::TokenService).to receive(:token).and_return(token) | ||
RequestStore.store['request_id'] = request_id | ||
end | ||
|
||
it 'returns correct headers' do | ||
expect(subject.headers).to eq({ 'Referer' => 'https://review-instance.va.gov', | ||
'X-VAMF-JWT' => token, | ||
'X-Request-ID' => request_id }) | ||
end | ||
end | ||
|
||
describe '#referrer' do | ||
context 'when ends in .gov' do | ||
it 'returns the hostname with "vets" replaced with "va"' do | ||
allow(Settings).to receive(:hostname).and_return('veteran.apps.vets.gov') | ||
expect(subject.referrer).to eq('https://veteran.apps.va.gov') | ||
end | ||
end | ||
|
||
context 'when does not end in .gov' do | ||
it 'returns https://review-instance.va.gov' do | ||
expect(subject.referrer).to eq('https://review-instance.va.gov') | ||
end | ||
end | ||
end | ||
end |