Sha256: ff4960cc4d4c14c7d90b7298bbf4164992706bdf54d869a83004b751291d5226

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

module USCoreTestKit
  module USCoreV311
    class ProfileSupportTest < Inferno::Test
      id :us_core_profile_support
      title 'Capability Statement lists support for required US Core Resoruce Types'
      description %(
        The US Core Implementation Guide states:

        ```
        The US Core Server SHALL:
        1. Support the US Core Patient resource.
        2. Support at least one additional US Core resources.

        In order to support USCDI, servers must support all USCDI resources.
        ```
      )
      uses_request :capability_statement

      run do
        assert_resource_type(:capability_statement)
        capability_statement = resource

        supported_resources =
          capability_statement.rest
            &.each_with_object([]) do |rest, resources|
              rest.resource.each { |resource| resources << resource.type }
            end.uniq

        assert supported_resources.include?('Patient'), 'US Core Patient profile not supported'

        us_core_resources = config.options[:us_core_resources]

        other_resources = us_core_resources.reject { |resource_type| resource_type == 'Patient' }
        other_resources_supported = other_resources.any? { |resource| supported_resources.include? resource }
        assert other_resources_supported, 'No US Core resources other than Patient are supported'

        if config.options[:required_resources].present?
          missing_resources = config.options[:required_resources] - supported_resources

          missing_resource_list =
            missing_resources
            .map { |resource| "`#{resource}`" }
            .join(', ')

          assert missing_resources.empty?,
                "The CapabilityStatement did not list support for the following resources: #{missing_resource_list}"
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
us_core_test_kit-0.8.2 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.8.1 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.8.0 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.7.2 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.7.1 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.7.0 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.6.5 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.6.4 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.6.3 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.6.2 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb
us_core_test_kit-0.6.1 lib/us_core_test_kit/custom_groups/v3.1.1/profile_support_test.rb