From a1d4f48bea8ecc4411eb081697b90fc4f48837d8 Mon Sep 17 00:00:00 2001 From: John Grimes Date: Fri, 19 Jan 2024 12:16:38 +1000 Subject: [PATCH] Add additional union tests --- tests/content/union_all.json | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/content/union_all.json b/tests/content/union_all.json index 2a5ff5d..5c790c6 100644 --- a/tests/content/union_all.json +++ b/tests/content/union_all.json @@ -225,6 +225,77 @@ ] }, "expect": [{ "family": "f1" }, { "family": "f1" }, { "family": "f2" }, { "family": "f3" }] + }, + { + "title": "unionAll with one empty operand", + "view": { + "resource": "Patient", + "select": [ + { + "unionAll": [ + { + "forEach": "name.where(false)", + "column": [{ "path": "family", "name": "family" }] + }, + { + "forEach": "contact.name", + "column": [{ "path": "family", "name": "family" }] + } + ] + } + ] + }, + "expect": [{ "family": "f2" }, { "family": "f3" }] + }, + { + "title": "unionAll with empty result", + "view": { + "resource": "Patient", + "select": [ + { + "column": [ + { + "path": "id", + "name": "id" + } + ], + "unionAll": [ + { + "forEach": "{}", + "column": [{ "path": "family", "name": "family" }] + } + ] + } + ] + }, + "expect": [] + }, + { + "title": "unionAll with empty result and forEachOrNull", + "view": { + "resource": "Patient", + "select": [ + { + "column": [ + { + "path": "id", + "name": "id" + } + ], + "unionAll": [ + { + "forEachOrNull": "{}", + "column": [{ "path": "family", "name": "family" }] + }, + { + "forEachOrNull": "{}", + "column": [{ "path": "family", "name": "family" }] + } + ] + } + ] + }, + "expect": [{"id": "p1", "family": null},{"id": "p1", "family": null}] } ] }