Skip to content

Commit

Permalink
updated the doctypes for 5103 notices in the DDL controller, test dat…
Browse files Browse the repository at this point in the history
…a, and unit test (#15820)
  • Loading branch information
samcoforma authored Mar 7, 2024
1 parent f8bb8f6 commit 07d01b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/controllers/v0/claim_letters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def service
def allowed_doctypes
doctypes = %w[184]
doctypes << '27' if Flipper.enabled?(:cst_include_ddl_boa_letters, @current_user)
doctypes << '65' if Flipper.enabled?(:cst_include_ddl_5103_letters, @current_user)
doctypes << '68' if Flipper.enabled?(:cst_include_ddl_5103_letters, @current_user)
doctypes << '704' if Flipper.enabled?(:cst_include_ddl_5103_letters, @current_user)
doctypes << '706' if Flipper.enabled?(:cst_include_ddl_5103_letters, @current_user)
doctypes << '858' if Flipper.enabled?(:cst_include_ddl_5103_letters, @current_user)
doctypes
end
end
Expand Down
23 changes: 19 additions & 4 deletions lib/claim_letters/claim_letter_test_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ module ClaimLetterTestData
series_id: '{350C072A-90A1-43A7-AD50-A5C9C54C357D}',
version: '1',
type_description: 'Standard 5103 Notice',
type_id: '65',
doc_type: '65',
type_id: '704',
doc_type: '704',
subject: nil,
received_at: Date.new(2022,8,22),
source: 'VBMS',
Expand All @@ -161,15 +161,30 @@ module ClaimLetterTestData
series_id: '{350C072A-90A1-43A7-AD50-A5C9C54C357E}',
version: '1',
type_description: '5103/DTA Letter',
type_id: '68',
doc_type: '68',
type_id: '706',
doc_type: '706',
subject: nil,
received_at: Date.new(2023,1,22),
source: 'VBMS',
mime_type: 'application/pdf',
alt_doc_types: '',
restricted: false,
upload_date: Date.new(2023,1,23)
),
OpenStruct.new(
document_id: '{27832B64-2D88-4DEE-9F6F-DF80E4CAAA92}',
series_id: '{350C072A-90A1-43A7-AD50-A5C9C54C357F}',
version: '1',
type_description: 'Custom 5103 Notice',
type_id: '858',
doc_type: '858',
subject: nil,
received_at: Date.new(2023,1,24),
source: 'VBMS',
mime_type: 'application/pdf',
alt_doc_types: '',
restricted: false,
upload_date: Date.new(2023,1,24)
)
].freeze
end
4 changes: 2 additions & 2 deletions spec/controllers/v0/claim_letters_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
it 'lists correct documents' do
get(:index)
letters = JSON.parse(response.body)
allowed_letters = letters.select { |d| d['doc_type'] == '27' || d['doc_type'] == '184' }
allowed_letters = letters.select { |d| %w[27 184].include?(d['doc_type']) }

expect(allowed_letters.length).to eql(letters.length)
end
Expand All @@ -49,7 +49,7 @@
it 'lists correct documents' do
get(:index)
letters = JSON.parse(response.body)
allowed_letters = letters.select { |d| d['doc_type'] == '65' || d['doc_type'] == '68' || d['doc_type'] == '184' }
allowed_letters = letters.select { |d| %w[704 706 858 184].include?(d['doc_type']) }

expect(allowed_letters.length).to eql(letters.length)
end
Expand Down

0 comments on commit 07d01b6

Please sign in to comment.