From 8ab869ef713add3578b1002ae965ae3c812b854a Mon Sep 17 00:00:00 2001 From: Yngvarr Date: Thu, 22 Feb 2024 12:16:19 +0100 Subject: [PATCH 1/2] made test_report runnable --- test_report/prepare.js | 14 +++++------- test_report/public/implementations.json | 30 ++++++++++++++++++++++++- test_report/src/App.svelte | 5 +---- test_report/src/Impls.svelte | 3 --- test_report/src/Playground.svelte | 1 - test_report/src/Tests.svelte | 2 -- 6 files changed, 36 insertions(+), 19 deletions(-) mode change 120000 => 100644 test_report/public/implementations.json diff --git a/test_report/prepare.js b/test_report/prepare.js index 7d50a37..64918a0 100644 --- a/test_report/prepare.js +++ b/test_report/prepare.js @@ -2,18 +2,16 @@ import fhirpath from 'fhirpath' import fs from 'fs' import path from 'path' -const CONTENT = '../sof-tests/' -const files = fs.readdirSync(CONTENT) +const CONTENT = '../tests/'; +const files = fs.readdirSync(CONTENT); const allResults = [] await Promise.all( files.map(async (file) => { - if (path.extname(file) !== '.json') return - let testData - let validate - testData = JSON.parse(fs.readFileSync(CONTENT + file)) - allResults.push(testData) + if (path.extname(file) !== '.json') return; + const testData = JSON.parse(fs.readFileSync(CONTENT + file)); + allResults.push(testData); }) ) -fs.writeFileSync('public/tests.json', JSON.stringify(allResults, null, " ")) +fs.writeFileSync('public/tests.json', JSON.stringify(allResults, null, " ")); diff --git a/test_report/public/implementations.json b/test_report/public/implementations.json deleted file mode 120000 index cb239bd..0000000 --- a/test_report/public/implementations.json +++ /dev/null @@ -1 +0,0 @@ -implementations.json \ No newline at end of file diff --git a/test_report/public/implementations.json b/test_report/public/implementations.json new file mode 100644 index 0000000..f452d30 --- /dev/null +++ b/test_report/public/implementations.json @@ -0,0 +1,29 @@ +[ + { + "name": "Ref.Impl", + "url": "https://github.com/FHIR/sql-on-fhir-v2", + "description": "Official reference implementation in JavaScript", + "testResultsUrl": "https://fhir.github.io/sql-on-fhir-v2/test-results.json" + }, + { + "name": "Aidbox", + "url": "https://docs.aidbox.app/storage-1/sql-on-fhir", + "description": "FHIR++ Platform by Health Samurai", + "testResultsUrl": "https://storage.googleapis.com/aidbox-public/sof-test-results.json" + }, + { + "name": "Google", + "url": "TBD", + "description": "TBD" + }, + { + "name": "Pathling", + "url": "TBD", + "description": "TBD" + }, + { + "name": "Grahame Impl", + "url": "TBD", + "description": "TBD" + } +] diff --git a/test_report/src/App.svelte b/test_report/src/App.svelte index a91d999..8220442 100644 --- a/test_report/src/App.svelte +++ b/test_report/src/App.svelte @@ -10,15 +10,12 @@ export let url = ""; onMount(async function () { - console.log('add location change') window.addEventListener('hashchange', function(){ hash = window.location.hash.substring(1); - console.log(hash); }) }) let hash = window.location.hash.substring(1); - console.log(hash); @@ -26,7 +23,7 @@
- + SQL on FHIR 2.0 Playground diff --git a/test_report/src/Impls.svelte b/test_report/src/Impls.svelte index 24ca9cc..2d87adb 100644 --- a/test_report/src/Impls.svelte +++ b/test_report/src/Impls.svelte @@ -15,16 +15,13 @@ onMount(async function () { tests = await load('tests.json'); - console.log('tests',tests); var tmp = await load('implementations.json'); for (const impl of tmp) { if (impl.testResultsUrl){ let res = await load(impl.testResultsUrl); impl.results = res; - console.log('res', res); } } - console.log('impls', tmp); impls = tmp; }); diff --git a/test_report/src/Playground.svelte b/test_report/src/Playground.svelte index c5fd843..35df5e6 100644 --- a/test_report/src/Playground.svelte +++ b/test_report/src/Playground.svelte @@ -74,7 +74,6 @@ function tabelize(v, results) { let columns = get_columns(v) - console.log('?',columns); let rows = [] for( var row of results) { rows.push(columns.map((k)=>{ diff --git a/test_report/src/Tests.svelte b/test_report/src/Tests.svelte index 810addb..24f3ffc 100644 --- a/test_report/src/Tests.svelte +++ b/test_report/src/Tests.svelte @@ -15,11 +15,9 @@ onMount(async function () { menu = await load('tests.json'); impls = await load('implementations.json'); - console.log('?', impls); let hash = window.location.hash.substring(1); current = menu[0]; menu.forEach((x)=> { - console.log('*',hash, x.file); if(x.file == hash) { current = x }; From 2ccb5e2498329692116ecdb23ed8e613a14bc11c Mon Sep 17 00:00:00 2001 From: Yngvarr Date: Thu, 22 Feb 2024 17:47:36 +0100 Subject: [PATCH 2/2] updated the test runner --- sof-js/tests/testrunner_example.js | 164 +- test_report/prepare.js | 1 + test_report/public/implementations.json | 2 +- test_report/public/test-results.json | 2530 ++++++++++++++++++++++- test_report/src/Impls.svelte | 5 +- 5 files changed, 2640 insertions(+), 62 deletions(-) diff --git a/sof-js/tests/testrunner_example.js b/sof-js/tests/testrunner_example.js index 5407b61..d346576 100644 --- a/sof-js/tests/testrunner_example.js +++ b/sof-js/tests/testrunner_example.js @@ -1,7 +1,6 @@ import fs from 'fs' import { evaluate } from '../src/index.js' - function isEqual(a, b) { if (Array.isArray(a) && Array.isArray(b)) { return a.length === b.length && a.every((val, index) => isEqual(val, b[index])) @@ -33,7 +32,7 @@ const canonicalize = (arr) => { function arraysMatch(arr1, arr2) { // Canonicalize arrays - arr1 = canonicalize(arr1) // Spread to avoid mutating the original array + arr1 = canonicalize(arr1) arr2 = canonicalize(arr2) // Check if arrays are of the same length @@ -77,62 +76,111 @@ function arraysMatch(arr1, arr2) { } } -// let tests_dir = '../../tests/' -let fast_fail = true -let tests_dir = '../../legacy-tests/content/' -let files = fs.readdirSync(tests_dir) -console.log(files); -let test_results = {pass: 0, fail: 0, error: 0} -let result = files.map((f)=>{ - let testcase = JSON.parse(fs.readFileSync(tests_dir + f)) - console.log('run', testcase.title, `file ${f}`) - testcase.tests.map((test)=>{ - if(test.expectError) { - try { - let _result = evaluate(test.view, testcase.resources) - console.log(' *', test.title, ' => ', 'fail' ) - test_results.fail+=1 - } catch (e) { - console.log(' *', test.title, ' => ', 'pass' ) - test_results.pass+=1 - } +function runThrowingTest(test, resources) { + try { + const result = evaluate(test.view, resources) + return { + passed: false, + expectedFail: true, + actual: result + } + } catch (e) { + return { passed: true } + } +} + +function runTest(test, resources) { + if (test.expectError) { + return runThrowingTest(test); + } + + try { + const result = evaluate(test.view, resources) + + if (test.expectCount) { + const passed = result.length === test.expectCount; + return passed + ? { passed } + : { + passed, + expectedCount: test.expectCount, + actual: result.length + }; } else { - try { - let result = evaluate(test.view, testcase.resources) - if(test.expectCount) { - if(result.length == test.expectCount) { - console.log(' *', test.title, ' => ', 'pass' ) - test_results.pass+=1 - } else { - console.log(' *', test.title, ' => ', 'fail', 'expected: ', test.expectCount, 'got ', result.length, result) - test_results.fail+=1 - } - } else { - let match = arraysMatch(result, test.expect) - test.observed = result; - test.passed = match.passed - test.error = match.error - if(match.passed){ - console.log(' *', test.title, ' => ', 'pass' ) - test_results.pass+=1 - } else { - console.log(' *', test.title, ' => ', 'fail' , 'expeceted: ', test.expect, 'got: ', result) - test_results.fail+=1 - } - } - } catch (e) { - console.log(' *', test.title, ' => ', 'error', e.toString()) - test_results.error+=1 - if(fast_fail) { - console.log('view', JSON.stringify(test, null, " ")) - throw e - } - // console.log(e) - } + const match = arraysMatch(result, test.expect) + return { + passed: match.passed, + expected: test.expect, + actual: result, + message: match.message + }; } - }) - return testcase; -}) + } catch (e) { + return { + passed: null, + message: e.toString() + } + } +} + +function printResult(title, result) { + let testResult; + if (result.passed === true) { + testResult = "passed"; + } else if (result.passed === false) { + testResult = "failed"; + } else { + testResult = "error"; + } + + console.log( " *", title, " => ", testResult); + + if (result.passed !== true) { + if (result.expected && result.actual) { + console.log("expected:"); + console.dir(result.expected, { depth: null }); + console.log("got:"); + console.dir(result.actual, { depth: null }); + } + if (result.message) { + console.log(result.message); + } + } +} + +const tests_dir = '../tests/' +const files = fs.readdirSync(tests_dir) +let test_summary = { pass: 0, fail: 0, error: 0 } + +const result = {}; +files.forEach(f => { + const testcase = JSON.parse(fs.readFileSync(tests_dir + f)) + console.log('running', testcase.title, `file ${f}`) + + const testResult = testcase.tests.map(test => { + let result = null; + + if (test.expectError) { + result = runThrowingTest(test, testcase.resources); + printResult(test.title, result); + } else { + result = runTest(test, testcase.resources); + printResult(test.title, result); + } + + if (result.passed === true) { + test_summary.pass++; + } else if (result.passed === false) { + test_summary.fail++; + } else { + test_summary.error++; + } + + return { result }; + }); + + result[f] = { tests: testResult }; +}); -fs.writeFileSync('../../test_report/public/test-results.json', JSON.stringify(result)); -console.log(test_results) +fs.writeFileSync('../test_report/public/test-results.json', JSON.stringify(result)); +console.log(test_summary) diff --git a/test_report/prepare.js b/test_report/prepare.js index 64918a0..b75a8aa 100644 --- a/test_report/prepare.js +++ b/test_report/prepare.js @@ -10,6 +10,7 @@ await Promise.all( files.map(async (file) => { if (path.extname(file) !== '.json') return; const testData = JSON.parse(fs.readFileSync(CONTENT + file)); + testData.file = path.basename(file); allResults.push(testData); }) ) diff --git a/test_report/public/implementations.json b/test_report/public/implementations.json index f452d30..b597b1c 100644 --- a/test_report/public/implementations.json +++ b/test_report/public/implementations.json @@ -3,7 +3,7 @@ "name": "Ref.Impl", "url": "https://github.com/FHIR/sql-on-fhir-v2", "description": "Official reference implementation in JavaScript", - "testResultsUrl": "https://fhir.github.io/sql-on-fhir-v2/test-results.json" + "testResultsUrl": "http://localhost:5000/test-results.json" }, { "name": "Aidbox", diff --git a/test_report/public/test-results.json b/test_report/public/test-results.json index 9624ebb..d1598d4 100644 --- a/test_report/public/test-results.json +++ b/test_report/public/test-results.json @@ -1 +1,2529 @@ -[{"title":"forEach, forEachOrNull","resources":[{"resourceType":"Patient","id":"p1","name":[{"use":"official","family":"f1"}],"contact":[{"gender":"other"}]}],"tests":[{"title":"forEach matching some","view":{"resource":"Patient","select":[{"forEach":"name","select":[{"column":[{"path":"family","name":"family"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expect":[{"family":"f1"}],"observed":[{"family":"f1"}],"passed":true},{"title":"forEach matching some, using $this","view":{"resource":"Patient","select":[{"forEach":"name","select":[{"column":[{"path":"$this.family","name":"family"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expect":[{"family":"f1"}],"observed":[{"family":"f1"}],"passed":true},{"title":"forEach matching some, using $this","view":{"resource":"Patient","select":[{"forEach":"name.family","select":[{"column":[{"path":"$this","name":"family"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expect":[{"family":"f1"}],"observed":[{"family":"f1"}],"passed":true},{"title":"forEach matching none","view":{"resource":"Patient","select":[{"forEach":"address.where(text='never-match')","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expect":[],"observed":[],"passed":true},{"title":"forEachOrNull matching none","view":{"resource":"Patient","select":[{"forEachOrNull":"address.where(text='never-match')","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"forEachOrNull"}],"type":"select"},"expect":[{"id":null}],"observed":[{"id":null}],"passed":true}]},{"title":"unionAll","resources":[{"resourceType":"Patient","id":"p1","name":[{"use":"official","family":"f1"}],"contact":[{"name":{"family":"f2"}},{"name":{"family":"f3"}}]}],"tests":[{"title":"unionAll of names","view":{"resource":"Patient","select":[{"unionAll":[{"forEach":"name","select":[{"column":[{"path":"family","name":"family"}],"type":"column"}],"type":"forEach"},{"forEach":"contact.name","select":[{"column":[{"path":"family","name":"family"}],"type":"column"}],"type":"forEach"}],"type":"unionAll"}],"type":"select"},"expect":[{"family":"f1"},{"family":"f2"},{"family":"f3"}],"observed":[{"family":"f1"},{"family":"f2"},{"family":"f3"}],"passed":true},{"title":"unionAll with different internal column names","view":{"resource":"Patient","select":[{"unionAll":[{"forEach":"name","select":[{"column":[{"path":"family","name":"a"},{"path":"{}","name":"b"}],"type":"column"}],"type":"forEach"},{"forEach":"contact.name","select":[{"column":[{"path":"{}","name":"a"},{"path":"family","name":"b"}],"type":"column"}],"type":"forEach"}],"type":"unionAll"}],"type":"select"},"expect":[{"a":"f1","b":null},{"a":null,"b":"f2"},{"a":null,"b":"f3"}],"observed":[{"a":"f1","b":null},{"a":null,"b":"f2"},{"a":null,"b":"f3"}],"passed":true},{"title":"unionAll with mismatching branches","view":{"resource":"Patient","select":[{"unionAll":[{"column":[{"path":"'a'","name":"a"}],"type":"column"},{"column":[{"path":"'b'","name":"b"}],"type":"column"}],"type":"unionAll"}],"type":"select"},"expectError":true},{"title":"unionAll with forEachOrNull","view":{"resource":"Patient","select":[{"forEachOrNull":"address.where(id = 'never-match')","select":[{}],"type":"forEachOrNull"}],"type":"select"},"expect":[{"letter":null}],"observed":[],"passed":false},{"title":"unionAll of names with column","view":{"resource":"Patient","select":[{"select":[{"column":[{"path":"'x'","name":"common"}],"type":"column"},{"unionAll":[{"forEach":"name","select":[{"column":[{"path":"family","name":"family"}],"type":"column"}],"type":"forEach"},{"forEach":"contact.name","select":[{"column":[{"path":"family","name":"family"}],"type":"column"}],"type":"forEach"}],"type":"unionAll"}],"type":"select"}],"type":"select"},"expect":[{"common":"x","family":"f1"},{"common":"x","family":"f2"},{"common":"x","family":"f3"}],"observed":[{"family":"f1","common":"x"},{"family":"f2","common":"x"},{"family":"f3","common":"x"}],"passed":true},{"title":"unionAll of names with column and select","view":{"resource":"Patient","select":[{"column":[{"path":"'x'","name":"commonx"}],"select":[{"unionAll":[{"forEach":"name","select":[{"column":[{"path":"family","name":"p_family"}],"type":"column"}],"type":"forEach"},{"forEach":"contact.name","select":[{"column":[{"path":"family","name":"p_family"}],"type":"column"}],"type":"forEach"}],"type":"unionAll"},{"forEach":"contact.name","select":[{"column":[{"path":"family","name":"c_family"}],"type":"column"}],"type":"forEach"}],"type":"select"}],"type":"select"},"expect":[{"commonx":"x","c_family":"f2","p_family":"f1"},{"commonx":"x","c_family":"f3","p_family":"f1"},{"commonx":"x","c_family":"f2","p_family":"f2"},{"commonx":"x","c_family":"f3","p_family":"f2"},{"commonx":"x","c_family":"f2","p_family":"f3"},{"commonx":"x","c_family":"f3","p_family":"f3"}],"observed":[{"c_family":"f2","p_family":"f1"},{"c_family":"f2","p_family":"f2"},{"c_family":"f2","p_family":"f3"},{"c_family":"f3","p_family":"f1"},{"c_family":"f3","p_family":"f2"},{"c_family":"f3","p_family":"f3"}],"passed":false}]},{"title":"exists function","resources":[{"resourceType":"Patient","id":"p1","name":[{"use":"official","family":"f1"}]},{"resourceType":"Patient","id":"p2"},{"resourceType":"Patient","id":"p3","name":[{"use":"nickname","given":["g3"]}]}],"tests":[{"title":"exists in field path","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"path":"name.exists()","name":"has_name"}],"type":"column"}],"type":"select"},"expect":[{"id":"p1","has_name":true},{"id":"p2","has_name":false},{"id":"p3","has_name":true}],"observed":[{"id":"p1","has_name":true},{"id":"p2","has_name":false},{"id":"p3","has_name":true}],"passed":true},{"title":"nested exists in field path","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"path":"name.given.exists()","name":"has_name"}],"type":"column"}],"type":"select"},"expect":[{"id":"p1","has_name":false},{"id":"p2","has_name":false},{"id":"p3","has_name":true}],"observed":[{"id":"p1","has_name":false},{"id":"p2","has_name":false},{"id":"p3","has_name":true}],"passed":true},{"title":"exists in where path","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.exists()"}],"type":"select"},"expect":[{"id":"p1"},{"id":"p3"}],"observed":[{"id":"p1"},{"id":"p3"}],"passed":true},{"title":"nested exists in where path","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.given.exists()"}],"type":"select"},"expect":[{"id":"p3"}],"observed":[{"id":"p3"}],"passed":true},{"title":"exists in forEach path","view":{"resource":"Patient","select":[{"forEach":"where(name.exists())","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expect":[{"id":"p1"},{"id":"p3"}],"observed":[{"id":"p1"},{"id":"p3"}],"passed":true},{"title":"Empty sub-select kills results","view":{"resource":"Patient","select":[{"forEach":"where(name.exists())","select":[{"column":[{"path":"id","name":"id"}],"type":"column"},{"forEach":"name.where(text='never-match')","select":[{"column":[{"path":"'never'","name":"never"}],"type":"column"}],"type":"forEach"}],"type":"forEach"}],"type":"select"},"expect":[],"observed":[],"passed":true}]},{"title":"simple path traversal","resources":[{"resourceType":"Observation","status":"preliminary","valueString":"positive","subject":{"reference":"Patient/123"},"code":{"coding":[{"code":"123"}]},"component":[{"code":{"coding":[{"code":"456"}]}}]}],"tests":[{"title":"single segment","view":{"resource":"Observation","select":[{"column":[{"path":"status","name":"status"}],"type":"column"}],"type":"select"},"expect":[{"status":"preliminary"}],"observed":[{"status":"preliminary"}],"passed":true},{"title":"single segment with name","view":{"resource":"Observation","select":[{"column":[{"path":"status","name":"ob_status"}],"type":"column"}],"type":"select"},"expect":[{"ob_status":"preliminary"}],"observed":[{"ob_status":"preliminary"}],"passed":true},{"title":"segment with choice type","view":{"resource":"Observation","select":[{"column":[{"path":"value.ofType(string)","name":"valueString"}],"type":"column"}],"type":"select"},"expect":[{"valueString":"positive"}],"observed":[{"valueString":"positive"}],"passed":true},{"title":"multiple segments","view":{"resource":"Observation","select":[{"column":[{"path":"subject.reference","name":"reference"}],"type":"column"}],"type":"select"},"expect":[{"reference":"Patient/123"}],"observed":[{"reference":"Patient/123"}],"passed":true},{"title":"multiple segments, one level of nesting","view":{"resource":"Observation","select":[{"column":[{"path":"code.coding.code","name":"code"}],"type":"column"}],"type":"select"},"expect":[{"code":"123"}],"observed":[{"code":"123"}],"passed":true},{"title":"multiple segments, multiple level of nesting ","view":{"resource":"Observation","select":[{"column":[{"path":"component.code.coding.code","name":"code"}],"type":"column"}],"type":"select"},"expect":[{"code":"456"}],"observed":[{"code":"456"}],"passed":true},{"title":"null values","view":{"resource":"Observation","select":[{"column":[{"path":"status","name":"status"},{"name":"identifier_value","path":"identifier.first().value"}],"type":"column"}],"type":"select"},"expect":[{"status":"preliminary","identifier_value":null}],"observed":[{"status":"preliminary","identifier_value":null}],"passed":true}]},{"title":"join function","resources":[{"resourceType":"Patient","id":"p1","name":[{"use":"official","given":["p1.g1","p1.g2"]}]}],"tests":[{"title":"join with comma","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"path":"name.given.join(',')","name":"given"}],"type":"column"}],"type":"select"},"expect":[{"id":"p1","given":"p1.g1,p1.g2"}],"observed":[{"id":"p1","given":"p1.g1,p1.g2"}],"passed":true},{"title":"join with empty value","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"path":"name.given.join('')","name":"given"}],"type":"column"}],"type":"select"},"expect":[{"id":"p1","given":"p1.g1p1.g2"}],"observed":[{"id":"p1","given":"p1.g1p1.g2"}],"passed":true},{"title":"join with no value - default to no separator","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"path":"name.given.join()","name":"given"}],"type":"column"}],"type":"select"},"expect":[{"id":"p1","given":"p1.g1p1.g2"}],"observed":[{"id":"p1","given":"p1.g1p1.g2"}],"passed":true}]},{"title":"first function","resources":[{"resourceType":"Patient","name":[{"use":"official","family":"f1","given":["g1.1","g1.2"]},{"use":"usual","given":["g2.1"]},{"use":"maiden","family":"f3","given":["g3.1","g3.2"],"period":{"end":"2002"}}]}],"tests":[{"title":"table level first()","view":{"resource":"Patient","select":[{"column":[{"path":"name.first().use","name":"use"}],"type":"column"}],"type":"select"},"expect":[{"use":"official"}],"observed":[{"use":"official"}],"passed":true},{"title":"table and field level first()","view":{"resource":"Patient","select":[{"column":[{"path":"name.first().given.first()","name":"given"}],"type":"column"}],"type":"select"},"expect":[{"given":"g1.1"}],"observed":[{"given":"g1.1"}],"passed":true}]},{"title":"validation","resources":[{"resourceType":"Observation","status":"preliminary","valueString":"positive","subject":{"reference":"Patient/123"},"code":{"coding":[{"code":"123"}]},"component":[{"code":{"coding":[{"code":"456"}]}}]}],"tests":[{"title":"column names must be unique","view":{"resource":"Observation","select":[{"column":[{"path":"status","name":"status"},{"path":"code.coding.code","name":"status"}],"type":"column"}],"type":"select"},"expectError":true}]},{"title":"where function and element","resources":[{"resourceType":"Patient","id":"p1","name":[{"use":"official","family":"f1"}]},{"resourceType":"Patient","id":"p2","name":[{"use":"nickname","family":"f2"}]},{"resourceType":"Patient","id":"p3","name":[{"use":"nickname","given":["g3"],"family":"f3"}]},{"resourceType":"Observation","id":"o1","valueInteger":12},{"resourceType":"Observation","id":"o2","valueInteger":10}],"tests":[{"title":"simple where path with result","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(use = 'official').exists()"}],"type":"select"},"expect":[{"id":"p1"}],"observed":[{"id":"p1"}],"passed":true},{"title":"where path with no results","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(use = 'maiden').exists()"}],"type":"select"},"expect":[],"observed":[],"passed":true},{"title":"where path with greater than inequality","view":{"resource":"Observation","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"where(value.ofType(integer) > 11).exists()"}],"type":"select"},"expect":[{"id":"o1"}],"observed":[{"id":"o1"}],"passed":true},{"title":"where path with less than inequality","view":{"resource":"Observation","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"where(value.ofType(integer) < 11).exists()"}],"type":"select"},"expect":[{"id":"o2"}],"observed":[{"id":"o2"}],"passed":true},{"title":"multiple where paths","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(use = 'official').exists()"},{"path":"name.where(family = 'f1').exists()"}],"type":"select"},"expect":[{"id":"p1"}],"observed":[{"id":"p1"}],"passed":true},{"title":"where path with an 'and' connector","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(use = 'official' and family = 'f1').exists()"}],"type":"select"},"expect":[{"id":"p1"}],"observed":[{"id":"p1"}],"passed":true},{"title":"where path with an 'or' connector","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(use = 'official' or family = 'f2').exists()"}],"type":"select"},"expect":[{"id":"p1"},{"id":"p2"}],"observed":[{"id":"p1"},{"id":"p2"}],"passed":true},{"title":"where path that evaluates to true when empty","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"where":[{"path":"name.where(family = 'f2').empty()"}],"type":"select"},"expect":[{"id":"p1"},{"id":"p3"}],"observed":[{"id":"p1"},{"id":"p3"}],"passed":true}]},{"title":"extension function","resources":[{"resourceType":"Patient","id":"pt1","meta":{"profile":["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"]},"extension":[{"id":"birthsex","url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex","valueCode":"F"},{"id":"race","url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race","extension":[{"url":"ombCategory","valueCoding":{"system":"urn:oid:2.16.840.1.113883.6.238","code":"2106-3","display":"White"}},{"url":"text","valueString":"Mixed"}]},{"id":"sex","url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"}]},{"resourceType":"Patient","id":"pt2","meta":{"profile":["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"]},"extension":[{"id":"birthsex","url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex","valueCode":"M"},{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-race","id":"race","extension":[{"url":"ombCategory","valueCoding":{"system":"urn:oid:2.16.840.1.113883.6.238","code":"2135-2","display":"Hispanic or Latino"}},{"url":"text","valueString":"Mixed"}]},{"id":"sex","url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex","valueCode":"248152002"}]},{"resourceType":"Patient","id":"pt3","meta":{"profile":["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"]},"extension":[]}],"tests":[{"title":"simple extension","description":"flatten simple extension","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"name":"birthsex","path":"extension('http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex').value.ofType(code).first()"}],"type":"column"}],"type":"select"},"expect":[{"id":"pt1","birthsex":"F"},{"id":"pt2","birthsex":"M"},{"id":"pt3","birthsex":null}],"observed":[{"id":"pt1","birthsex":"F"},{"id":"pt2","birthsex":"M"},{"id":"pt3","birthsex":null}],"passed":true},{"title":"nested extension","description":"flatten simple extension","view":{"resource":"Patient","select":[{"column":[{"path":"id","name":"id"},{"name":"race_code","path":"extension('http://hl7.org/fhir/us/core/StructureDefinition/us-core-race').extension('ombCategory').value.ofType(Coding).code.first()"}],"type":"column"}],"type":"select"},"expect":[{"id":"pt1","race_code":"2106-3"},{"id":"pt2","race_code":"2135-2"},{"id":"pt3","race_code":null}],"observed":[{"id":"pt1","race_code":"2106-3"},{"id":"pt2","race_code":"2135-2"},{"id":"pt3","race_code":null}],"passed":true}]},{"title":"logic","resources":[{"resourceType":"Patient","id":"m0","gender":"male","deceasedBoolean":false},{"resourceType":"Patient","id":"f0","deceasedBoolean":false,"gender":"female"},{"resourceType":"Patient","id":"m1","gender":"male","deceasedBoolean":true},{"resourceType":"Patient","id":"f1","gender":"female"}],"tests":[{"title":"filtering with 'and'","view":{"resource":"Patient","where":[{"path":"gender = 'male' and deceased.ofType(boolean) = false"}],"select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"select"},"expect":[{"id":"m0"}],"observed":[{"id":"m0"}],"passed":true},{"title":"filtering with 'or'","view":{"resource":"Patient","where":[{"path":"gender = 'male' or deceased.ofType(boolean) = false"}],"select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"select"},"expect":[{"id":"m0"},{"id":"m1"},{"id":"f0"}],"observed":[{"id":"m0"},{"id":"f0"},{"id":"m1"}],"passed":true},{"title":"filtering with 'not'","view":{"resource":"Patient","where":[{"path":"(gender = 'male').not()"}],"select":[{"column":[{"path":"id","name":"id"}],"type":"column"}],"type":"select"},"expect":[{"id":"f0"},{"id":"f1"}],"observed":[{"id":"f0"},{"id":"f1"}],"passed":true}]},{"title":"collection parameter","resources":[{"resourceType":"Patient","id":"pt1","name":[{"use":"official","family":"f1.1","given":["g1.1"]},{"family":"f1.2","given":["g1.2","g1.3"]}],"gender":"male","birthDate":"1950-01-01","address":[{"city":"c1"}]},{"resourceType":"Patient","id":"pt2","name":[{"family":"f2.1","given":["g2.1"]},{"use":"official","family":"f2.2","given":["g2.2","g2.3"]}],"gender":"female","birthDate":"1950-01-01"}],"tests":[{"title":"Fail when `collection` is not true","view":{"resource":"Patient","select":[{"column":[{"name":"id","path":"id"},{"name":"last_name","path":"name.family","collection":false},{"name":"first_name","path":"name.given","collection":true}],"type":"column"}],"type":"select"},"expectError":true},{"title":"`collection` true","view":{"resource":"Patient","select":[{"column":[{"name":"id","path":"id"},{"name":"last_name","path":"name.family","collection":true},{"name":"first_name","path":"name.given","collection":true}],"type":"column"}],"type":"select"},"expect":[{"id":"pt1","last_name":["f1.1","f1.2"],"first_name":["g1.1","g1.2","g1.3"]},{"id":"pt2","last_name":["f2.1","f2.2"],"first_name":["g2.1","g2.2","g2.3"]}],"observed":[{"id":"pt1","last_name":["f1.1","f1.2"],"first_name":["g1.1","g1.2","g1.3"]},{"id":"pt2","last_name":["f2.1","f2.2"],"first_name":["g2.1","g2.2","g2.3"]}],"passed":true}]},{"title":"resourceKey and referenceKey functions","resources":[{"resourceType":"Observation","id":"o1","basedOn":[{"reference":"ServiceRequest/123"},{"reference":"https://example.org/fhir/ServiceRequest/456"},{"reference":"CarePlan/123"}]}],"tests":[{"title":"get resource key","view":{"resource":"Observation","select":[{"column":[{"path":"getResourceKey()","name":"id"}],"type":"column"}],"type":"select"},"expectCount":1},{"title":"get reference key","view":{"resource":"Observation","select":[{"forEach":"basedOn","select":[{"column":[{"name":"rid","path":"getReferenceKey()"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expectCount":3},{"title":"get reference key with resource param","view":{"resource":"Observation","select":[{"forEach":"basedOn.where(getReferenceKey(CarePlan).exists())","select":[{"column":[{"name":"rid","path":"getReferenceKey()"}],"type":"column"}],"type":"forEach"}],"type":"select"},"expectCount":1}]}] \ No newline at end of file +{ + "foreach.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "family": "F1.1" + }, + { + "id": "pt1", + "family": "F1.2" + }, + { + "id": "pt2", + "family": "F2.1" + }, + { + "id": "pt2", + "family": "F2.2" + } + ], + "actual": [ + { + "family": "F1.1", + "id": "pt1" + }, + { + "family": "F1.2", + "id": "pt1" + }, + { + "family": "F2.1", + "id": "pt2" + }, + { + "family": "F2.2", + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "family": "F1.1" + }, + { + "id": "pt1", + "family": "F1.2" + }, + { + "id": "pt2", + "family": "F2.1" + }, + { + "id": "pt2", + "family": "F2.2" + }, + { + "id": "pt3", + "family": null + } + ], + "actual": [ + { + "family": "F1.1", + "id": "pt1" + }, + { + "family": "F1.2", + "id": "pt1" + }, + { + "family": "F2.1", + "id": "pt2" + }, + { + "family": "F2.2", + "id": "pt2" + }, + { + "family": null, + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [], + "actual": [] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "pat_family": "F1.1", + "cont_family": "FC1.1" + }, + { + "pat_family": "F1.1", + "cont_family": "FC1.2" + }, + { + "pat_family": "F1.2", + "cont_family": "FC1.1" + }, + { + "pat_family": "F1.2", + "cont_family": "FC1.2" + } + ], + "actual": [ + { + "pat_family": "F1.1", + "cont_family": "FC1.1" + }, + { + "pat_family": "F1.1", + "cont_family": "FC1.2" + }, + { + "pat_family": "F1.2", + "cont_family": "FC1.1" + }, + { + "pat_family": "F1.2", + "cont_family": "FC1.2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [], + "actual": [] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "value": null + }, + { + "id": "pt2", + "value": null + }, + { + "id": "pt3", + "value": null + } + ], + "actual": [ + { + "value": null, + "id": "pt1" + }, + { + "value": null, + "id": "pt2" + }, + { + "value": null, + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "family": "F1.1", + "value": null + }, + { + "id": "pt1", + "family": "F1.2", + "value": null + }, + { + "id": "pt2", + "family": "F2.1", + "value": null + }, + { + "id": "pt2", + "family": "F2.2", + "value": null + } + ], + "actual": [ + { + "family": "F1.1", + "value": null, + "id": "pt1" + }, + { + "family": "F1.2", + "value": null, + "id": "pt1" + }, + { + "family": "F2.1", + "value": null, + "id": "pt2" + }, + { + "family": "F2.2", + "value": null, + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "contact_type": "phone", + "name": "N1", + "id": "pt1" + }, + { + "contact_type": "phone", + "name": "N1`", + "id": "pt1" + }, + { + "contact_type": "email", + "name": "N2", + "id": "pt1" + } + ], + "actual": [ + { + "name": "N1", + "contact_type": "phone", + "id": "pt1" + }, + { + "name": "N1`", + "contact_type": "phone", + "id": "pt1" + }, + { + "name": "N2", + "contact_type": "email", + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "contact_type": "phone", + "name": "N1", + "id": "pt1" + }, + { + "contact_type": "phone", + "name": "N1`", + "id": "pt1" + }, + { + "contact_type": "email", + "name": "N2", + "id": "pt1" + } + ], + "actual": [ + { + "name": "N1", + "contact_type": "phone", + "id": "pt1" + }, + { + "name": "N1`", + "contact_type": "phone", + "id": "pt1" + }, + { + "name": "N2", + "contact_type": "email", + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "name": "FC1.1" + }, + { + "id": "pt1", + "name": "N1" + }, + { + "id": "pt1", + "name": "N1`" + }, + { + "id": "pt1", + "name": "FC1.2" + }, + { + "id": "pt1", + "name": "N2" + }, + { + "id": "pt2", + "name": null + }, + { + "id": "pt3", + "name": null + } + ], + "actual": [ + { + "name": "FC1.1", + "id": "pt1" + }, + { + "name": "N1", + "id": "pt1" + }, + { + "name": "N1`", + "id": "pt1" + }, + { + "name": "FC1.2", + "id": "pt1" + }, + { + "name": "N2", + "id": "pt1" + }, + { + "name": null, + "id": "pt2" + }, + { + "name": null, + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "name": "FC1.1" + }, + { + "id": "pt1", + "name": "N1" + }, + { + "id": "pt1", + "name": "N1`" + }, + { + "id": "pt1", + "name": "FC1.2" + }, + { + "id": "pt1", + "name": "N2" + } + ], + "actual": [ + { + "name": "FC1.1", + "id": "pt1" + }, + { + "name": "N1", + "id": "pt1" + }, + { + "name": "N1`", + "id": "pt1" + }, + { + "name": "FC1.2", + "id": "pt1" + }, + { + "name": "N2", + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "name": "FC1.1", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "N1", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "N1`", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "FC1.2", + "tel_system": "email", + "gender": "unknown" + }, + { + "id": "pt1", + "name": "N2", + "tel_system": "email", + "gender": "unknown" + } + ], + "actual": [ + { + "gender": null, + "name": "FC1.1", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": null, + "name": "N1", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": null, + "name": "N1`", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": "unknown", + "name": "FC1.2", + "tel_system": "email", + "id": "pt1" + }, + { + "gender": "unknown", + "name": "N2", + "tel_system": "email", + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "name": "FC1.1", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "N1", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "N1`", + "tel_system": "phone", + "gender": null + }, + { + "id": "pt1", + "name": "FC1.2", + "tel_system": "email", + "gender": "unknown" + }, + { + "id": "pt1", + "name": "N2", + "tel_system": "email", + "gender": "unknown" + }, + { + "id": "pt2", + "name": null, + "tel_system": null, + "gender": null + }, + { + "id": "pt3", + "name": null, + "tel_system": null, + "gender": null + } + ], + "actual": [ + { + "gender": null, + "name": "FC1.1", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": null, + "name": "N1", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": null, + "name": "N1`", + "tel_system": "phone", + "id": "pt1" + }, + { + "gender": "unknown", + "name": "FC1.2", + "tel_system": "email", + "id": "pt1" + }, + { + "gender": "unknown", + "name": "N2", + "tel_system": "email", + "id": "pt1" + }, + { + "gender": null, + "name": null, + "tel_system": null, + "id": "pt2" + }, + { + "gender": null, + "name": null, + "tel_system": null, + "id": "pt3" + } + ] + } + } + ] + }, + "basic.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + }, + { + "id": "pt2" + }, + { + "id": "pt3" + } + ], + "actual": [ + { + "id": "pt1" + }, + { + "id": "pt2" + }, + { + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "active": true + }, + { + "id": "pt2", + "active": false + }, + { + "id": "pt3", + "active": null + } + ], + "actual": [ + { + "id": "pt1", + "active": true + }, + { + "id": "pt2", + "active": false + }, + { + "id": "pt3", + "active": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "last_name": "F1" + }, + { + "id": "pt2", + "last_name": "F2" + }, + { + "id": "pt3", + "last_name": null + } + ], + "actual": [ + { + "id": "pt1", + "last_name": "F1" + }, + { + "id": "pt2", + "last_name": "F2" + }, + { + "id": "pt3", + "last_name": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "last_name": "F1" + }, + { + "id": "pt2", + "last_name": "F2" + }, + { + "id": "pt3", + "last_name": null + } + ], + "actual": [ + { + "last_name": "F1", + "id": "pt1" + }, + { + "last_name": "F2", + "id": "pt2" + }, + { + "last_name": null, + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + } + ], + "actual": [ + { + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt2" + } + ], + "actual": [ + { + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": null, + "message": "'where' expression path should return 'boolean'" + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt2" + } + ], + "actual": [ + { + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + } + ], + "actual": [ + { + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "c_id": "pt1", + "s_id": "pt1" + }, + { + "c_id": "pt2", + "s_id": "pt2" + }, + { + "c_id": "pt3", + "s_id": "pt3" + } + ], + "actual": [ + { + "s_id": "pt1", + "c_id": "pt1" + }, + { + "s_id": "pt2", + "c_id": "pt2" + }, + { + "s_id": "pt3", + "c_id": "pt3" + } + ] + } + } + ] + }, + "collection.json": { + "tests": [ + { + "result": { + "passed": true + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "last_name": [ + "f1.1", + "f1.2" + ], + "first_name": [ + "g1.1", + "g1.2", + "g1.3" + ] + }, + { + "id": "pt2", + "last_name": [ + "f2.1", + "f2.2" + ], + "first_name": [ + "g2.1", + "g2.2", + "g2.3" + ] + } + ], + "actual": [ + { + "id": "pt1", + "last_name": [ + "f1.1", + "f1.2" + ], + "first_name": [ + "g1.1", + "g1.2", + "g1.3" + ] + }, + { + "id": "pt2", + "last_name": [ + "f2.1", + "f2.2" + ], + "first_name": [ + "g2.1", + "g2.2", + "g2.3" + ] + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "last_name": "f1.1", + "first_name": [ + "g1.1" + ] + }, + { + "id": "pt1", + "last_name": "f1.2", + "first_name": [ + "g1.2", + "g1.3" + ] + }, + { + "id": "pt2", + "last_name": "f2.1", + "first_name": [ + "g2.1" + ] + }, + { + "id": "pt2", + "last_name": "f2.2", + "first_name": [ + "g2.2", + "g2.3" + ] + } + ], + "actual": [ + { + "last_name": "f1.1", + "first_name": [ + "g1.1" + ], + "id": "pt1" + }, + { + "last_name": "f1.2", + "first_name": [ + "g1.2", + "g1.3" + ], + "id": "pt1" + }, + { + "last_name": "f2.1", + "first_name": [ + "g2.1" + ], + "id": "pt2" + }, + { + "last_name": "f2.2", + "first_name": [ + "g2.2", + "g2.3" + ], + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "last_name": "f1.1", + "first_name": [ + "g1.1" + ] + }, + { + "id": "pt1", + "last_name": "f1.2", + "first_name": [ + "g1.2", + "g1.3" + ] + }, + { + "id": "pt2", + "last_name": "f2.1", + "first_name": [ + "g2.1" + ] + }, + { + "id": "pt2", + "last_name": "f2.2", + "first_name": [ + "g2.2", + "g2.3" + ] + } + ], + "actual": [ + { + "last_name": "f1.1", + "first_name": [ + "g1.1" + ], + "id": "pt1" + }, + { + "last_name": "f1.2", + "first_name": [ + "g1.2", + "g1.3" + ], + "id": "pt1" + }, + { + "last_name": "f2.1", + "first_name": [ + "g2.1" + ], + "id": "pt2" + }, + { + "last_name": "f2.2", + "first_name": [ + "g2.2", + "g2.3" + ], + "id": "pt2" + } + ] + } + } + ] + }, + "fn_empty.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "p1", + "name_empty": false + }, + { + "id": "p2", + "name_empty": true + } + ], + "actual": [ + { + "id": "p1", + "name_empty": false + }, + { + "id": "p2", + "name_empty": true + } + ] + } + } + ] + }, + "fhirpath.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + }, + { + "id": "pt2" + }, + { + "id": "pt3" + } + ], + "actual": [ + { + "id": "pt1" + }, + { + "id": "pt2" + }, + { + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": "f1.1" + }, + { + "v": "f2.1" + }, + { + "v": null + } + ], + "actual": [ + { + "v": "f1.1" + }, + { + "v": "f2.1" + }, + { + "v": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": [ + "f1.1", + "f1.2" + ] + }, + { + "v": [ + "f2.1", + "f2.2" + ] + }, + { + "v": [] + } + ], + "actual": [ + { + "v": [ + "f1.1", + "f1.2" + ] + }, + { + "v": [ + "f2.1", + "f2.2" + ] + }, + { + "v": [] + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": "f1.1" + }, + { + "v": "f2.1" + }, + { + "v": null + } + ], + "actual": [ + { + "v": "f1.1" + }, + { + "v": "f2.1" + }, + { + "v": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": "f1.2" + }, + { + "v": "f2.2" + }, + { + "v": null + } + ], + "actual": [ + { + "v": "f1.2" + }, + { + "v": "f2.2" + }, + { + "v": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": null + }, + { + "v": null + }, + { + "v": null + } + ], + "actual": [ + { + "v": null + }, + { + "v": null + }, + { + "v": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "v": "f1.1" + }, + { + "v": "f2.2" + }, + { + "v": null + } + ], + "actual": [ + { + "v": "f1.1" + }, + { + "v": "f2.2" + }, + { + "v": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "has_name": true + }, + { + "id": "pt2", + "has_name": true + }, + { + "id": "pt3", + "has_name": false + } + ], + "actual": [ + { + "id": "pt1", + "has_name": true + }, + { + "id": "pt2", + "has_name": true + }, + { + "id": "pt3", + "has_name": false + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "has_given": true + }, + { + "id": "pt2", + "has_given": false + }, + { + "id": "pt3", + "has_given": false + } + ], + "actual": [ + { + "id": "pt1", + "has_given": true + }, + { + "id": "pt2", + "has_given": false + }, + { + "id": "pt3", + "has_given": false + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "first_given": "g1.1.1" + }, + { + "id": "pt2", + "first_given": null + }, + { + "id": "pt3", + "first_given": null + } + ], + "actual": [ + { + "id": "pt1", + "first_given": "g1.1.1" + }, + { + "id": "pt2", + "first_given": null + }, + { + "id": "pt3", + "first_given": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "first_family": "f1.1" + }, + { + "id": "pt2", + "first_family": "f2.1" + }, + { + "id": "pt3", + "first_family": null + } + ], + "actual": [ + { + "id": "pt1", + "first_family": "f1.1" + }, + { + "id": "pt2", + "first_family": "f2.1" + }, + { + "id": "pt3", + "first_family": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "given": "g1.1.1, g1.1.2, g1.2.1" + }, + { + "id": "pt2", + "given": "" + }, + { + "id": "pt3", + "given": "" + } + ], + "actual": [ + { + "id": "pt1", + "given": "g1.1.1, g1.1.2, g1.2.1" + }, + { + "id": "pt2", + "given": "" + }, + { + "id": "pt3", + "given": "" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "given": "g1.1.1g1.1.2g1.2.1" + }, + { + "id": "pt2", + "given": "" + }, + { + "id": "pt3", + "given": "" + } + ], + "actual": [ + { + "id": "pt1", + "given": "g1.1.1g1.1.2g1.2.1" + }, + { + "id": "pt2", + "given": "" + }, + { + "id": "pt3", + "given": "" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "Patient/pt1" + }, + { + "id": "Patient/pt2" + }, + { + "id": "Patient/pt3" + } + ], + "actual": [ + { + "id": "Patient/pt1" + }, + { + "id": "Patient/pt2" + }, + { + "id": "Patient/pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "ref": "o1" + }, + { + "id": "pt2", + "ref": "o2" + }, + { + "id": "pt3", + "ref": null + } + ], + "actual": [ + { + "id": "pt1", + "ref": "o1" + }, + { + "id": "pt2", + "ref": "o2" + }, + { + "id": "pt3", + "ref": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "ref": "o1" + }, + { + "id": "pt2", + "ref": "o2" + }, + { + "id": "pt3", + "ref": null + } + ], + "actual": [ + { + "id": "pt1", + "ref": "o1" + }, + { + "id": "pt2", + "ref": "o2" + }, + { + "id": "pt3", + "ref": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "ref": null + }, + { + "id": "pt2", + "ref": null + }, + { + "id": "pt3", + "ref": null + } + ], + "actual": [ + { + "id": "pt1", + "ref": null + }, + { + "id": "pt2", + "ref": null + }, + { + "id": "pt3", + "ref": null + } + ] + } + } + ] + }, + "fn_boundary.json": { + "tests": [] + }, + "view_resource.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + }, + { + "id": "pt2" + } + ], + "actual": [ + { + "id": "pt1" + }, + { + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "ob1" + } + ], + "actual": [ + { + "id": "ob1" + } + ] + } + }, + { + "result": { + "passed": false, + "expectedFail": true, + "actual": [ + { + "id": "pt1" + }, + { + "id": "pt2" + }, + { + "id": "ob1" + } + ] + } + } + ] + }, + "fn_oftype.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "o1", + "string_value": "foo" + }, + { + "id": "o2", + "string_value": null + }, + { + "id": "o3", + "string_value": null + } + ], + "actual": [ + { + "id": "o1", + "string_value": "foo" + }, + { + "id": "o2", + "string_value": null + }, + { + "id": "o3", + "string_value": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "o1", + "integer_value": null + }, + { + "id": "o2", + "integer_value": 42 + }, + { + "id": "o3", + "integer_value": null + } + ], + "actual": [ + { + "id": "o1", + "integer_value": null + }, + { + "id": "o2", + "integer_value": 42 + }, + { + "id": "o3", + "integer_value": null + } + ] + } + }, + { + "result": { + "passed": false, + "expectedFail": true, + "actual": [ + { + "id": "o1", + "invalid_value": null + }, + { + "id": "o2", + "invalid_value": null + }, + { + "id": "o3", + "invalid_value": null + } + ] + } + }, + { + "result": { + "passed": false, + "expectedFail": true, + "actual": [ + { + "id": "o1", + "invalid_argument": null + }, + { + "id": "o2", + "invalid_argument": null + }, + { + "id": "o3", + "invalid_argument": null + } + ] + } + } + ] + }, + "validate.json": { + "tests": [ + { + "result": { + "passed": false, + "expectedFail": true, + "actual": [] + } + }, + { + "result": { + "passed": true + } + }, + { + "result": { + "passed": true + } + }, + { + "result": { + "passed": true + } + } + ] + }, + "constant.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "official_name": "Smith" + }, + { + "id": "pt2", + "official_name": null + } + ], + "actual": [ + { + "id": "pt1", + "official_name": "Smith" + }, + { + "id": "pt2", + "official_name": null + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "official_name": "Smith" + } + ], + "actual": [ + { + "official_name": "Smith" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1" + } + ], + "actual": [ + { + "id": "pt1" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "name": "Smith" + }, + { + "name": "Block" + }, + { + "name": "Johnson" + } + ], + "actual": [ + { + "name": "Smith" + }, + { + "name": "Block" + }, + { + "name": "Johnson" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "official_name": "Smith" + }, + { + "id": "pt2", + "official_name": "Menendez" + } + ], + "actual": [ + { + "id": "pt1", + "official_name": "Smith" + }, + { + "id": "pt2", + "official_name": "Menendez" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt2" + } + ], + "actual": [ + { + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true + } + }, + { + "result": { + "passed": false, + "expectedFail": true, + "actual": [ + { + "id": "pt1", + "official_name": null + }, + { + "id": "pt2", + "official_name": null + } + ] + } + } + ] + }, + "union.json": { + "tests": [ + { + "result": { + "passed": true, + "expected": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.c1.1", + "sys": "s1.c1.1", + "id": "pt1" + }, + { + "tel": "t1.c2.1", + "sys": "s1.c2.1", + "id": "pt1" + }, + { + "tel": "t1.c2.2", + "sys": "s1.c2.2", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t3.c1.1", + "sys": "s3.c1.1", + "id": "pt3" + }, + { + "tel": "t3.c1.2", + "sys": "s3.c1.2", + "id": "pt3" + }, + { + "tel": "t3.c2.1", + "sys": "s3.c2.1", + "id": "pt3" + } + ], + "actual": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.c1.1", + "sys": "s1.c1.1", + "id": "pt1" + }, + { + "tel": "t1.c2.1", + "sys": "s1.c2.1", + "id": "pt1" + }, + { + "tel": "t1.c2.2", + "sys": "s1.c2.2", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t3.c1.1", + "sys": "s3.c1.1", + "id": "pt3" + }, + { + "tel": "t3.c1.2", + "sys": "s3.c1.2", + "id": "pt3" + }, + { + "tel": "t3.c2.1", + "sys": "s3.c2.1", + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.c1.1", + "sys": "s1.c1.1", + "id": "pt1" + }, + { + "tel": "t1.c2.1", + "sys": "s1.c2.1", + "id": "pt1" + }, + { + "tel": "t1.c2.2", + "sys": "s1.c2.2", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t3.c1.1", + "sys": "s3.c1.1", + "id": "pt3" + }, + { + "tel": "t3.c1.2", + "sys": "s3.c1.2", + "id": "pt3" + }, + { + "tel": "t3.c2.1", + "sys": "s3.c2.1", + "id": "pt3" + } + ], + "actual": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.c1.1", + "sys": "s1.c1.1", + "id": "pt1" + }, + { + "tel": "t1.c2.1", + "sys": "s1.c2.1", + "id": "pt1" + }, + { + "tel": "t1.c2.2", + "sys": "s1.c2.2", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t3.c1.1", + "sys": "s3.c1.1", + "id": "pt3" + }, + { + "tel": "t3.c1.2", + "sys": "s3.c1.2", + "id": "pt3" + }, + { + "tel": "t3.c2.1", + "sys": "s3.c2.1", + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + } + ], + "actual": [ + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t1.1", + "sys": "s1.1", + "id": "pt1" + }, + { + "tel": "t1.2", + "sys": "s1.2", + "id": "pt1" + }, + { + "tel": "t1.3", + "sys": "s1.3", + "id": "pt1" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + }, + { + "tel": "t2.1", + "sys": "s2.1", + "id": "pt2" + }, + { + "tel": "t2.2", + "sys": "s2.2", + "id": "pt2" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [], + "actual": [] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt4" + }, + { + "given": null, + "id": "pt4" + } + ], + "actual": [ + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt4" + }, + { + "given": null, + "id": "pt4" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt4" + } + ], + "actual": [ + { + "given": null, + "id": "pt1" + }, + { + "given": null, + "id": "pt2" + }, + { + "given": null, + "id": "pt3" + }, + { + "given": null, + "id": "pt4" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "tel": "t1.1" + }, + { + "id": "pt1", + "tel": "t1.1" + }, + { + "id": "pt1", + "tel": "t1.c1.1" + }, + { + "id": "pt2", + "tel": "t2.1" + }, + { + "id": "pt2", + "tel": "t2.1" + }, + { + "id": "pt3", + "tel": "t3.c1.1" + } + ], + "actual": [ + { + "tel": "t1.1", + "id": "pt1" + }, + { + "tel": "t1.1", + "id": "pt1" + }, + { + "tel": "t1.c1.1", + "id": "pt1" + }, + { + "tel": "t2.1", + "id": "pt2" + }, + { + "tel": "t2.1", + "id": "pt2" + }, + { + "tel": "t3.c1.1", + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true, + "expected": [ + { + "id": "pt1", + "sys": "s1.c1.1", + "tel": "t1.c1.1" + }, + { + "id": "pt1", + "sys": "s1.c2.1", + "tel": "t1.c2.1" + }, + { + "id": "pt1", + "sys": "s1.c2.2", + "tel": "t1.c2.2" + }, + { + "id": "pt3", + "sys": "s3.c1.1", + "tel": "t3.c1.1" + }, + { + "id": "pt3", + "sys": "s3.c1.2", + "tel": "t3.c1.2" + }, + { + "id": "pt3", + "sys": "s3.c2.1", + "tel": "t3.c2.1" + } + ], + "actual": [ + { + "tel": "t1.c1.1", + "sys": "s1.c1.1", + "id": "pt1" + }, + { + "tel": "t1.c2.1", + "sys": "s1.c2.1", + "id": "pt1" + }, + { + "tel": "t1.c2.2", + "sys": "s1.c2.2", + "id": "pt1" + }, + { + "tel": "t3.c1.1", + "sys": "s3.c1.1", + "id": "pt3" + }, + { + "tel": "t3.c1.2", + "sys": "s3.c1.2", + "id": "pt3" + }, + { + "tel": "t3.c2.1", + "sys": "s3.c2.1", + "id": "pt3" + } + ] + } + }, + { + "result": { + "passed": true + } + }, + { + "result": { + "passed": true + } + } + ] + } +} diff --git a/test_report/src/Impls.svelte b/test_report/src/Impls.svelte index 2d87adb..6c4ead5 100644 --- a/test_report/src/Impls.svelte +++ b/test_report/src/Impls.svelte @@ -15,7 +15,7 @@ onMount(async function () { tests = await load('tests.json'); - var tmp = await load('implementations.json'); + const tmp = await load('implementations.json'); for (const impl of tmp) { if (impl.testResultsUrl){ let res = await load(impl.testResultsUrl); @@ -23,7 +23,8 @@ } } impls = tmp; - + console.dir(tests, {depth: null}) + console.dir(impls, {depth: null}) });