|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'rails_helper' |
| 4 | + |
| 5 | +RSpec.describe Burials::FormProfiles::VA21p530ez, type: :model do |
| 6 | + subject { described_class.new(form_id: form_id, user: user) } |
| 7 | + |
| 8 | + let(:user) { build(:user, :loa3) } |
| 9 | + let(:form_id) { '21P-530EZ' } |
| 10 | + let(:address) { instance_double(Address, country: 'USA') } |
| 11 | + |
| 12 | + before do |
| 13 | + allow(FormProfile).to receive(:prefill_enabled_forms).and_return([form_id]) |
| 14 | + end |
| 15 | + |
| 16 | + describe '#metadata' do |
| 17 | + it 'returns correct metadata' do |
| 18 | + expect(subject.metadata).to eq( |
| 19 | + version: 0, |
| 20 | + prefill: true, |
| 21 | + returnUrl: '/claimant-information' |
| 22 | + ) |
| 23 | + |
| 24 | + subject.metadata |
| 25 | + end |
| 26 | + end |
| 27 | + |
| 28 | + describe '#prefill' do |
| 29 | + it 'initializes identity and contact information' do |
| 30 | + expect(subject.prefill).to match({ |
| 31 | + form_data: { |
| 32 | + 'claimantFullName' => |
| 33 | + { 'first' => 'Abraham', 'last' => 'Lincoln', 'suffix' => 'Jr.' }, |
| 34 | + 'claimantAddress' => |
| 35 | + { 'street' => '140 Rock Creek Rd', 'city' => 'Washington', 'state' => 'DC', |
| 36 | + 'country' => 'USA', 'postalCode' => '20011' }, |
| 37 | + 'claimantPhone' => '3035551234', |
| 38 | + 'claimantEmail' => kind_of(String) |
| 39 | + }, |
| 40 | + metadata: { version: 0, prefill: true, returnUrl: '/claimant-information' } |
| 41 | + }) |
| 42 | + end |
| 43 | + end |
| 44 | +end |
0 commit comments