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

FI-3463: DTR Light EHR: test supported payer endpoint #42

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

degradification
Copy link
Contributor

@degradification degradification commented Dec 16, 2024

Description

This ticket adds a test for DTR Light EHR requirement 102 to the DTR Light EHR suite. This defines an endpoint, which Inferno can respond to requests and return conformant information.

Important Changes

lib/davinci_dtr_test_kit/client_groups/light_ehr/dtr_light_ehr_supported_endpoints_group.rb

  • Defined the supported endpoints group

lib/davinci_dtr_test_kit/client_groups/light_ehr/dtr_light_ehr_supported_payer_endpoint_test.rb

  • Defined the test that the app can access the supported payer endpoint via a GET request & checks the header
    lib/davinci_dtr_test_kit/dtr_light_ehr_suite.rb
  • Defined the route for the new endpoint

lib/davinci_dtr_test_kit/dtr_light_ehr_suite.rb

  • Added requires
  • Defined the suite_endpoint
  • Added the group for the supported endpoints

lib/davinci_dtr_test_kit/endpoints/mock_payer/light_ehr_supported_payer_endpoint.rb

  • A GET route /supported-payers was defined to return a JSON response with a list of payers, each payer contains id & name)
  • Checks the header to see if it is application/json

spec/davinci_dtr_test_kit/dtr_light_ehr_supported_payer_endpoint_test_spec.rb

  • Implements unit tests for LightEHRSupportedPayerEndpoint
  • Test simulates a request to the endpoint and checks that the test waits for the request and then passes if received

lib/davinci_dtr_test_kit/tags.rb

  • Added tag for light ehr endpoint

lib/davinci_dtr_test_kit/urls.rb

  • Added supported payer path & url

Testing Recommendations

Make sure all unit tests pass including the ones that were added to this pull request, and the application runs as expected. Run the Light EHR tests to test both expected successes and expected failures. Run the SMART App Test Suite tests to test both expected success and expected failures.

Checklists

Submitter:

  • This MR describes why these changes were made.
  • This MR is into the correct branch (usually 'main').
  • Comment added to the relevant Jira ticket(s) with a link to this MR.
  • The relevant Jira ticket has been moved to 'Peer Review' (may be N/A if a Jira ticket is associated with multiple MRs)
  • Code diff has been reviewed (it does not contain: additional white space, not applicable code changes, debug statements, etc.).
  • Ensure automated tests pass successfully.

Final Merger

  • The necessary number of reviews/approvals have been received on this PR and all checklists have been completed.
  • The relevant Jira ticket has been moved to 'Done' (may N/A if a Jira ticket is associated with multiple MRs)

-TODO: Ensure the endpoint can be while unit testing
Copy link
Contributor

@vanessuniq vanessuniq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the url input from the suite level to the specific groups that require it, so that it is not required for the supported enpoint group.

id :dtr_light_ehr_supported_payer_endpoint
title 'Client can retrieve payers from supported payer endpoint'
description %(
Inferno, will wait for a request to return the payer details from the supported endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a description of what this test checks. something like, 'This test verifies that the app can successfully access the supported payer endpoint via a GET request, including an Accept header set to application/json'.

module DaVinciDTRTestKit
class DTRLightEhrSupportedEndpointsGroup < Inferno::TestGroup
id :dtr_light_ehr_supported_endpoints
title 'DTR Supported Endpoints'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title 'DTR Supported Endpoints'
title 'Supported Endpoints'

Comment on lines 144 to 154
group do
title 'DTR Light EHR Supported Endpoints'
description %(This test group tests system for their conformance to
the supported endpoint capabilities as defined by the DaVinci Documentation
Templates and Rules (DTR) v2.0.1 Implementation Guide Light DTR EHR
Capability Statement.

)

group from: :dtr_light_ehr_supported_endpoints
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don’t need to nest group from: :dtr_light_ehr_supported_endpoints within another group. You can simply use group from: :dtr_light_ehr_supported_endpoints directly. Update the dtr_light_ehr_supported_endpoints_group.rb file with this description.

@@ -0,0 +1,45 @@
require_relative '../mock_payer'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed, since no functionality from that module is being used here.

module DaVinciDTRTestKit
module MockPayer
class LightEHRSupportedPayerEndpoint < Inferno::DSL::SuiteEndpoint
include MockPayer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this as well

Comment on lines 40 to 42
def update_result
results_repo.update_result(result.id, 'pass') unless test.config.options[:accepts_multiple_requests]
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify this logic so that it fails if the Accept header is not application/json and passes otherwise.

@@ -0,0 +1,65 @@
require_relative '../request_helper'

RSpec.describe DaVinciDTRTestKit::DTRLightEhrSupportedEndpointsGroup do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write spec for the Test directly instead of the group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants