Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHV-56069-Update-rxRfRecords-structure #16046

Merged
merged 7 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class PrescriptionDetailsSerializer < PrescriptionSerializer
attribute :tracking
attribute :orderable_item
attribute :sorted_dispensed_date

def rx_rf_records
records = object&.rx_rf_records
records&.dig(0, 1) || []
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe MyHealth::V1::PrescriptionDetailsSerializer, type: :serializer do
subject { serialize(prescription, serializer_class: described_class) }

let(:prescription) { build(:prescription_details) }
let(:data) { JSON.parse(subject)['data'] }
let(:attributes) { data['attributes'] }

it 'includes the prescription_id' do
expect(attributes['prescription_id']).to eq(prescription.prescription_id)
end

it 'includes the refill_status' do
expect(attributes['refill_status']).to eq(prescription.refill_status)
end

it 'includes the refill_date' do
expect(attributes['refill_date']).to eq(prescription.refill_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the refill_submit_date' do
expect(attributes['refill_submit_date']).to eq(prescription.refill_submit_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the refill_remaining' do
expect(attributes['refill_remaining']).to eq(prescription.refill_remaining)
end

it 'includes the facility_name' do
expect(attributes['facility_name']).to eq(prescription.facility_name)
end

it 'includes the ordered_date' do
expect(attributes['ordered_date']).to eq(prescription.ordered_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the quantity' do
expect(attributes['quantity']).to eq(prescription.quantity)
end

it 'includes the expiration_date' do
expect(attributes['expiration_date']).to eq(prescription.expiration_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the prescription_number' do
expect(attributes['prescription_number']).to eq(prescription.prescription_number)
end

it 'includes the prescription_name' do
expect(attributes['prescription_name']).to eq(prescription.prescription_name)
end

it 'includes the dispensed_date' do
expect(attributes['dispensed_date']).to eq(prescription.dispensed_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the station_number' do
expect(attributes['station_number']).to eq(prescription.station_number)
end

it 'includes the is_refillable' do
expect(attributes['is_refillable']).to eq(prescription.is_refillable)
end

it 'includes the is_trackable' do
expect(attributes['is_trackable']).to eq(prescription.is_trackable)
end

it 'includes the in_cerner_transition' do
expect(attributes['in_cerner_transition']).to eq(prescription.in_cerner_transition)
end

it 'includes the not_refillable_display_message' do
expect(attributes['not_refillable_display_message']).to eq(prescription.not_refillable_display_message)
end

it 'includes the cmop_ndc_number' do
expect(attributes['cmop_ndc_number']).to eq(prescription.cmop_ndc_number)
end

it 'includes the sig' do
expect(attributes['sig']).to eq(prescription.sig)
end

it 'includes the user_id' do
expect(attributes['user_id']).to eq(prescription.user_id)
end

it 'includes the provider_first_name' do
expect(attributes['provider_first_name']).to eq(prescription.provider_first_name)
end

it 'includes the provider_last_name' do
expect(attributes['provider_last_name']).to eq(prescription.provider_last_name)
end

it 'includes the remarks' do
expect(attributes['remarks']).to eq(prescription.remarks)
end

it 'includes the division_name' do
expect(attributes['division_name']).to eq(prescription.division_name)
end

it 'includes the modified_date' do
expect(attributes['modified_date']).to eq(prescription.modified_date.strftime('%Y-%m-%dT%H:%M:%S.%LZ'))
end

it 'includes the institution_id' do
expect(attributes['institution_id']).to eq(prescription.institution_id)
end

it 'includes the dial_cmop_division_phone' do
expect(attributes['dial_cmop_division_phone']).to eq(prescription.dial_cmop_division_phone)
end

it 'includes the disp_status' do
expect(attributes['disp_status']).to eq(prescription.disp_status)
end

it 'includes the ndc' do
expect(attributes['ndc']).to eq(prescription.ndc)
end

it 'includes the reason' do
expect(attributes['reason']).to eq(prescription.reason)
end

it 'includes the prescription_number_index' do
expect(attributes['prescription_number_index']).to eq(prescription.prescription_number_index)
end

it 'includes the prescription_source' do
expect(attributes['prescription_source']).to eq(prescription.prescription_source)
end

it 'includes the disclaimer' do
expect(attributes['disclaimer']).to eq(prescription.disclaimer)
end

it 'includes the indication_for_use' do
expect(attributes['indication_for_use']).to eq(prescription.indication_for_use)
end

it 'includes the indication_for_use_flag' do
expect(attributes['indication_for_use_flag']).to eq(prescription.indication_for_use_flag)
end

it 'includes the category' do
expect(attributes['category']).to eq(prescription.category)
end

it 'includes the tracking' do
expect(attributes['tracking']).to eq(prescription.tracking)
end

it 'includes the orderable_item' do
expect(attributes['orderable_item']).to eq(prescription.orderable_item)
end

it 'includes the sorted_dispensed_date' do
expect(attributes['sorted_dispensed_date']).to eq(prescription.sorted_dispensed_date.strftime('%Y-%m-%d'))
end

it 'includes the rx_rf_records' do
expect(attributes['rx_rf_records']).to be_an(Array)
expect(attributes['rx_rf_records']).to all(be_a(Hash))
end
end
Loading