Skip to content

Commit

Permalink
Make all vawave files end in 3 digit numbers (#20370)
Browse files Browse the repository at this point in the history
Co-authored-by: achan <achan@Ubuntu.myguest.virtualbox.org>
  • Loading branch information
alexchan-va and achan authored Jan 21, 2025
1 parent 31537ee commit be07266
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/vye/lib/vye/batch_transfer/egress_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def address_changes_filename = prefixed_dated('CHGADD')
def direct_deposit_filename = prefixed_dated('DirDep')

# enrollment verification sent to BDN everyday.
def verification_filename = "vawave#{now_in_bdn_timezone.yday}"
def verification_filename = format('vawave%03d', now_in_bdn_timezone.yday)

public

Expand Down
40 changes: 40 additions & 0 deletions modules/vye/spec/lib/vye/batch_transfer/egress_files_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,44 @@

described_class.verification_upload
end

describe '#verification_filename' do
around do |example|
Timecop.freeze(time) { example.run }
end

let(:central_timezone) { 'Central Time (US & Canada)' }

context 'on first day of the year' do
let(:time) { Time.find_zone(central_timezone).local(2024, 1, 1, 12, 0, 0) }

it 'pads with zeros' do
expect(described_class.send(:verification_filename)).to eq('vawave001')
end
end

context 'on day 99 of the year' do
let(:time) { Time.find_zone(central_timezone).local(2024, 4, 8, 12, 0, 0) }

it 'pads with zeros' do
expect(described_class.send(:verification_filename)).to eq('vawave099')
end
end

context 'on last day of a leap year' do
let(:time) { Time.find_zone(central_timezone).local(2024, 12, 31, 12, 0, 0) }

it 'handles day 366' do
expect(described_class.send(:verification_filename)).to eq('vawave366')
end
end

context 'on last day of a non-leap year' do
let(:time) { Time.find_zone(central_timezone).local(2023, 12, 31, 12, 0, 0) }

it 'handles day 365' do
expect(described_class.send(:verification_filename)).to eq('vawave365')
end
end
end
end

0 comments on commit be07266

Please sign in to comment.