-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
15,902 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,64 @@ | ||
require_relative 'shared_setup' | ||
|
||
RSpec.describe DaVinciDTRTestKit::CQLTest do | ||
let(:test) { Class.new { extend DaVinciDTRTestKit::CQLTest, Inferno::DSL::Assertions } } | ||
|
||
describe 'given a bad response' do | ||
let(:output_params_no_lib) do | ||
FHIR.from_contents(File.read(File.join( | ||
__dir__, '..', | ||
'fixtures', 'questionnaire_package_output_params_conformant.json' | ||
))) | ||
include_context('when running standard tests', | ||
'payer_server_static_package', # group | ||
suite_id = :dtr_payer_server, | ||
"/custom/#{suite_id}/fhir/Questionnaire/$questionnaire-package", # questionnaire_package_url | ||
'Static', # retrieval_method | ||
'http://example.org/fhir/R4') # url | ||
|
||
context 'when output is valid' do | ||
let(:scratch) do | ||
{ output_parameters: FHIR.from_contents( | ||
File.read(File.join(__dir__, '..', 'fixtures', | ||
'questionnaire_package_output_params_conformant.json')) | ||
) } | ||
end | ||
|
||
it 'nothing should raise exception' do | ||
expect { test.check_libraries(nil) }.to raise_error( | ||
Inferno::Exceptions::AssertionException, /Response is null or not a valid type./ | ||
) | ||
describe 'static questionnaire package libraries test' do | ||
let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'static_form_libraries_test' } } | ||
|
||
it 'passes if questionnaire package has libraries' do | ||
result = run(runnable, test_session, scratch:, access_token:, retrieval_method:) | ||
expect(result.result).to eq('pass'), result.result_message | ||
end | ||
end | ||
|
||
it 'no libraries should raise exception' do | ||
expect { test.check_libraries(output_params_no_lib) }.to raise_error( | ||
Inferno::Exceptions::AssertionException, /No Libraries found./ | ||
) | ||
describe 'static questionnaire extensions check' do | ||
let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'static_form_expressions_test' } } | ||
|
||
it 'passes if questionnaire package has valid extensions' do | ||
result = run(runnable, test_session, scratch:, access_token:, retrieval_method:) | ||
expect(result.result).to eq('pass'), result.result_message | ||
end | ||
end | ||
end | ||
|
||
describe 'given a good response' do | ||
let(:output_params) do | ||
FHIR.from_contents(File.read(File.join( | ||
__dir__, '..', | ||
'fixtures', 'questionnaire_package_output_params_non_conformant.json' | ||
))) | ||
context 'when output is invalid' do | ||
let(:scratch) do | ||
{ output_parameters: FHIR.from_contents( | ||
File.read(File.join(__dir__, '..', 'fixtures', | ||
'questionnaire_package_output_params_non_conformant.json')) | ||
) } | ||
end | ||
|
||
it 'test should pass' do | ||
expect(test.check_libraries(output_params)).to equal(nil) | ||
describe 'static questionnaire package has no libraries test' do | ||
let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'static_form_libraries_test' } } | ||
|
||
it 'fails if questionnaire package has no libraries' do | ||
result = run(runnable, test_session, scratch:, access_token:, retrieval_method:) | ||
expect(result.result).to eq('fail'), result.result_message | ||
end | ||
end | ||
|
||
describe 'static questionnaire extensions check' do | ||
let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'static_form_expressions_test' } } | ||
|
||
it 'fails if questionnaire package has invalid extensions' do | ||
result = run(runnable, test_session, scratch:, access_token:, retrieval_method:) | ||
expect(result.result).to eq('fail'), result.result_message | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.