-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b150d7c
commit df19b56
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
modules/debts_api/spec/lib/debt_api/v0/fsr_form_transform/additional_data_calculator_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,35 @@ | ||
require 'rails_helper' | ||
require 'debts_api/v0/fsr_form_transform/additional_data_calculator' | ||
|
||
RSpec.describe DebtsApi::V0::FsrFormTransform::AdditionalDataCalculator, type: :service do | ||
describe 'get_bankruptcy_data' do | ||
let(:form) { get_fixture_absolute('modules/debts_api/spec/fixtures/pre_submission_fsr/pre_transform') } | ||
|
||
it 'returns bankruptcy data' do | ||
service = described_class.new(form) | ||
|
||
expect(service.get_bankruptcy_data).to eq({ | ||
'hasBeenAdjudicatedBankrupt' => true, | ||
Check failure on line 12 in modules/debts_api/spec/lib/debt_api/v0/fsr_form_transform/additional_data_calculator_spec.rb GitHub Actions / Linting and Security
|
||
'dateDischarged' => '02/2020', | ||
'courtLocation' => 'fdas', | ||
'docketNumber' => 'dfasa' | ||
}) | ||
Check failure on line 16 in modules/debts_api/spec/lib/debt_api/v0/fsr_form_transform/additional_data_calculator_spec.rb GitHub Actions / Linting and Security
|
||
end | ||
|
||
it 'handles empty date for date discharged' do | ||
form['additional_data']['bankruptcy']['date_discharged'] = '' | ||
service = described_class.new(form) | ||
|
||
expect(service.get_bankruptcy_data['dateDischarged']).to eq('00/0000') | ||
end | ||
|
||
it 'handles bad date for date discharged' do | ||
form['additional_data']['bankruptcy']['date_discharged'] = 'this is not a date' | ||
expect(Rails.logger).to receive(:error).with('DebtsApi AdditionalDataCalculator#get_discharge_date: invalid date') | ||
expect(Rails.logger).to receive(:info).with('DebtsApi AdditionalDataCalculator#get_discharge_date input: this is not a date') | ||
service = described_class.new(form) | ||
|
||
expect(service.get_bankruptcy_data['dateDischarged']).to eq('00/0000') | ||
end | ||
end | ||
end |