Sha256: 59860d9aff08015c939f83d3e50698ea889a790a1556e3e2e7f18e11abda555a

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

require_relative '../test_helper'

module DaVinciCRDTestKit
  class LaunchSmartAppCardValidationTest < Inferno::Test
    include DaVinciCRDTestKit::TestHelper

    title 'Valid Launch SMART Application cards received'
    id :crd_launch_smart_app_card_validation
    description %(
      This test verifies the presence of valid Launch SMART Application cards within the list of valid cards
      returned by the CRD service.
      As per the [Da Vinci CRD Implementation Guide](https://hl7.org/fhir/us/davinci-crd/STU2/cards.html#launch-smart-application),
      Launch SMART Application cards must contain links with the type set to `smart`.
      This test checks for the presence of any Launch SMART Application cards by verifying:
      - The existence of a `links` array within each card.
      - That every link in the `links` array of a card is of type `smart`.

      The test will be skipped if no Launch SMART Application cards are found within the returned valid cards.
    )

    optional
    input :valid_cards_with_links

    def hook_name
      config.options[:hook_name]
    end

    run do
      parsed_cards = parse_json(valid_cards_with_links)
      external_reference_cards = parsed_cards.select do |card|
        links = card['links']
        links.present? && links.all? { |link| link['type'] == 'smart' }
      end

      skip_if external_reference_cards.blank?, "#{hook_name} hook response does not contain any Launch SMART App cards."
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
davinci_crd_test_kit-0.10.0 lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb
davinci_crd_test_kit-0.9.1 lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb
davinci_crd_test_kit-0.9.1.rc lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb
davinci_crd_test_kit-0.9.0 lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb