us_core_test_kit 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0646308cfd9f7fae1d17b4b4b9c3f1cb3d09b1c6cfd9a649104beb0a65077672'
4
- data.tar.gz: bd6a3a0fa4427eed31e61d93da2b327bb43eaccf9accf5146fb089601a34a22e
3
+ metadata.gz: bf568ad98ad25b70c1ae8993657adb8eccc83f9ffeee841e6bb3a51b79ed9f56
4
+ data.tar.gz: 2c2761194d8edf9c70744ff832016d4f9643851041690c0c8bd71004e947083f
5
5
  SHA512:
6
- metadata.gz: bceab9b2ccb933f2af3931d342e7b8a86b4c5c258c2f57187d6bffe7c6856916a1d4db4b58878fcd549d3b8354fbacde2191ab6b0062bc361acb988a7fa2938a
7
- data.tar.gz: 031b914039a12f0263230605c6256a57864e4f0780db9379626a207f100adf824bffe03f32f99a55c751e8bced04de27043c1e12237d68c269bd85a9ea4358bb
6
+ metadata.gz: ea6bce62760d108adaeb3905bca2611b52059391a99b5ade0515fa2de61069a4d8bfa7479bb4c79dc0637297c9123bd28c274a276776330c8076ae2c2065a8ac
7
+ data.tar.gz: a29e81c48dd8965fa62a064ff69552e64e7b4cab0bab917c55e9b6ff402e3a8566d234c879852674d271156f46d656149d5de1b66023c853194327d43a06edba
@@ -13,18 +13,30 @@ module USCoreTestKit
13
13
  .options[:required_scopes]
14
14
  .map { |scope| scope[scope.index('/') + 1, scope.length] }
15
15
 
16
+ required_granular_regexes =
17
+ required_granular_scopes.flat_map do |scope|
18
+ [
19
+ Regexp.new(Regexp.quote(scope).gsub(".rs", ".r?s")),
20
+ Regexp.new(Regexp.quote(scope).gsub(".rs", ".rs?"))
21
+ ]
22
+ end
23
+
16
24
  received_granular_scopes =
17
25
  received_scopes
18
26
  .split(' ')
19
27
  .select { |scope| scope.include? '?' }
20
28
  .map { |scope| scope[scope.index('/') + 1, scope.length] }
21
29
 
22
- missing_scopes = required_granular_scopes - received_granular_scopes
30
+ missing_scopes =
31
+ required_granular_regexes
32
+ .reject do |required_scope|
33
+ received_granular_scopes.any? { |received_scope| received_scope.match?(required_scope) }
34
+ end
23
35
 
24
- wrapped_missing_scopes = missing_scopes.map { |scope| "`#{scope}`" }
36
+ wrapped_missing_scopes = missing_scopes.map { |scope| "`#{scope.source}`" }
25
37
 
26
38
  assert missing_scopes.empty?,
27
- "The following granular scopes were not granted: #{wrapped_missing_scopes.to_sentence}"
39
+ "Granular scopes matching the following were not matched: #{wrapped_missing_scopes.to_sentence}"
28
40
 
29
41
  granular_scope_resource_types =
30
42
  required_granular_scopes
@@ -28,7 +28,7 @@ module USCoreTestKit
28
28
  if request.status != 200
29
29
  []
30
30
  else
31
- fetch_all_bundled_resources
31
+ fetch_all_bundled_resources.select { |resource| resource.resourceType == resource_type }
32
32
  end
33
33
 
34
34
  mismatched_ids = mismatched_resource_ids(found_resources)
@@ -78,6 +78,7 @@ module USCoreTestKit
78
78
 
79
79
  def expected_resource_ids(resources)
80
80
  resources
81
+ .select { |resource| resource.resourceType == resource_type }
81
82
  .select do |resource|
82
83
  granular_scope_search_params.any? do |param|
83
84
  resource_matches_param?(resource, param[:name], param[:value])
@@ -88,6 +89,7 @@ module USCoreTestKit
88
89
 
89
90
  def mismatched_resource_ids(resources)
90
91
  resources
92
+ .select { |resource| resource.resourceType == resource_type }
91
93
  .reject do |resource|
92
94
  granular_scope_search_params.any? do |param|
93
95
  resource_matches_param?(resource, param[:name], param[:value])
@@ -737,16 +737,19 @@ module USCoreTestKit
737
737
 
738
738
  paths.each do |path|
739
739
  type = metadata.search_definitions[search_param_name.to_sym][:type]
740
- values_found =
741
- resolve_path(resource, path)
742
- .map do |value|
743
- if value.is_a? FHIR::Reference
744
- value.reference
745
- else
746
- value
747
- end
740
+
741
+ resolve_path(resource, path).each do |value|
742
+ values_found <<
743
+ if value.is_a? FHIR::Reference
744
+ value.reference
745
+ elsif value.is_a? USCoreTestKit::PrimitiveType
746
+ value.value
747
+ else
748
+ value
749
+ end
748
750
  end
749
751
 
752
+ values_found.compact!
750
753
  match_found =
751
754
  case type
752
755
  when 'Period', 'date', 'instant', 'dateTime'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module USCoreTestKit
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_core_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-01 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -2590,7 +2590,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2590
2590
  - !ruby/object:Gem::Version
2591
2591
  version: '0'
2592
2592
  requirements: []
2593
- rubygems_version: 3.5.7
2593
+ rubygems_version: 3.5.9
2594
2594
  signing_key:
2595
2595
  specification_version: 4
2596
2596
  summary: US Core Inferno tests