refactor: extract agent_connect logout_url to a agent_connect_service

This commit is contained in:
simon lehericey 2024-09-16 12:10:55 +02:00
parent 1706feec3d
commit 6f5135a6b2
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 27 additions and 8 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
describe AgentConnectService do
describe '.logout_url' do
let(:id_token) { 'id_token' }
before do
::AGENT_CONNECT ||= {}
allow(AGENT_CONNECT).to receive(:[])
.with(:end_session_endpoint).and_return("https://agent-connect.fr/logout")
end
subject { described_class.logout_url(id_token, host_with_port: 'test.host') }
it 'returns the correct url' do
expect(subject).to eq("https://agent-connect.fr/logout?id_token_hint=id_token&post_logout_redirect_uri=http%3A%2F%2Ftest.host%2Flogout")
end
end
end