Sha256: 7c4a31975c7792b53ba3bdc5ea663e932b199698a77063a12d276c1003287682

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

module ONCCertificationG10TestKit
  class SMARTWellKnownCapabilitiesTest < Inferno::Test
    include G10Options

    title 'Well-known configuration declares support for required capabilities'
    description %(
      A SMART on FHIR server SHALL convey its capabilities to app developers
      by listing the SMART core capabilities supported by their
      implementation within the Well-known configuration file. This test
      ensures that the capabilities required by this scenario are properly
      documented in the Well-known file.
    )
    id :g10_smart_well_known_capabilities
    input :well_known_configuration

    run do
      skip_if well_known_configuration.blank?, 'No well-known SMART configuration found.'

      assert_valid_json(well_known_configuration)
      capabilities = JSON.parse(well_known_configuration)['capabilities']
      assert capabilities.is_a?(Array),
             "Expected the well-known capabilities to be an Array, but found #{capabilities.class.name}"

      required_capabilities = config.options[:required_capabilities] || []

      if (using_us_core_5? || using_us_core_6? || using_us_core_7?) && required_capabilities.include?('launch-ehr')
        required_capabilities += ['context-ehr-encounter']
      end

      missing_capabilities = required_capabilities - capabilities
      assert missing_capabilities.empty?,
             "The following capabilities required for this scenario are missing: #{missing_capabilities.join(', ')}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onc_certification_g10_test_kit-7.0.1 lib/onc_certification_g10_test_kit/well_known_capabilities_test.rb
onc_certification_g10_test_kit-7.0.0 lib/onc_certification_g10_test_kit/well_known_capabilities_test.rb