Skip to content

Commit

Permalink
[594] Surface if candidate has one login account
Browse files Browse the repository at this point in the history
Via support console
  • Loading branch information
avinhurry committed Jan 22, 2025
1 parent 4c115b2 commit 2df3e7c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/components/support_interface/application_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def rows
subsequent_application_row,
average_distance_row,
editable_extension_row,
one_login_account_row,
].compact
end

Expand Down Expand Up @@ -85,6 +86,13 @@ def candidate_id_row
}
end

def one_login_account_row
{
key: 'Has One Login account',
value: one_login? ? 'Yes' : 'No',
}
end

def state_row
{
key: 'State',
Expand Down Expand Up @@ -140,6 +148,10 @@ def formatted_status
"<strong>#{name}</strong><br>#{desc}".html_safe
end

def one_login?
application_form.candidate.one_login_auth.present?
end

attr_reader :application_form
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,53 @@
expect(result.css('.govuk-summary-list__key').text).not_to include('Is this application editable')
end
end

context 'when the candidate has a OneLogin account' do
it 'displays "Yes" for the One Login account row' do
candidate = create(:candidate)
candidate.create_one_login_auth!(
token: '123',
email_address: candidate.email_address,
)
application_form = create(:completed_application_form, candidate:)

result = render_inline(described_class.new(application_form:))

expect(result.css('.govuk-summary-list__key').text).to include('Has One Login account')
expect(result.css('.govuk-summary-list__value').text).to include('Yes')
end
end

context 'when the candidate does not have a OneLogin account' do
it 'displays "No" for the One Login account row' do
candidate = create(:candidate)
application_form = create(:completed_application_form, candidate:)

result = render_inline(described_class.new(application_form:))

expect(result.css('.govuk-summary-list__key').text).to include('Has One Login account')
expect(result.css('.govuk-summary-list__value').text).to include('No')
end
end

context 'when the candidate had a OneLogin account but it was deleted' do
it 'displays "No" for the One Login account row' do
candidate = create(:candidate)
one_login_auth = candidate.create_one_login_auth!(
token: '123',
email_address: candidate.email_address,
)

one_login_auth.delete
candidate.reload

application_form = create(:completed_application_form, candidate:)

result = render_inline(described_class.new(application_form:))

expect(result.css('.govuk-summary-list__key').text).to include('Has One Login account')
expect(result.css('.govuk-summary-list__value').text).to include('No')
end
end
end
end

0 comments on commit 2df3e7c

Please sign in to comment.