Sha256: 9d96e7b2e4d149d2e6dcf9c41a5a964309eb1a53bf47e45e70155dc420e85a86

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

module USCoreTestKit
  class JSONSupportTest < Inferno::Test
    id :us_core_311_json_support
    title 'FHIR server capability states JSON support'
    description %(
      FHIR provides multiple [representation
      formats](https://www.hl7.org/fhir/formats.html) for resources, including
      JSON and XML. US Core profiles require servers to use the [JSON
      representation](https://www.hl7.org/fhir/json.html):

      [```The US Core Server **SHALL** Support json source formats for all US
      Core
      interactions.```](http://hl7.org/fhir/us/core/CapabilityStatement-us-core-server.html#behavior)

      The FHIR conformance interaction require servers to describe which
      formats are available for clients to use. The server must explicitly
      state that JSON is supported. This is located in the [format
      element](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.format)
      of the CapabilityStatement Resource.

      This test checks that one of the following values are located in the
      format field.

      * json
      * application/json
      * application/fhir+json
    )
    uses_request :capability_statement

    run do
      assert_resource_type(:capability_statement)

      json_formats = ['json', 'application/json', 'application/fhir+json']
      server_formats = resource.format

      assert server_formats.any? { |format| json_formats.include? format },
              'CapabilityStatement does not state support for JSON'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
us_core_test_kit-0.1.1 lib/us_core_test_kit/custom_groups/capability_statement/json_support_test.rb
us_core_test_kit-0.1.0 lib/us_core_test_kit/custom_groups/capability_statement/json_support_test.rb