From 7705d4288a633f9328800e5fec9c1dd99e777329 Mon Sep 17 00:00:00 2001 From: Edwin Tan Date: Wed, 20 Nov 2024 10:24:26 -0800 Subject: [PATCH] MAT-7852: add/modify unit tests --- src/api/TerminologyServiceApi.test.ts | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/api/TerminologyServiceApi.test.ts b/src/api/TerminologyServiceApi.test.ts index d3bb55766..62a92ec13 100644 --- a/src/api/TerminologyServiceApi.test.ts +++ b/src/api/TerminologyServiceApi.test.ts @@ -84,7 +84,7 @@ describe("TerminologyServiceApi Tests", () => { }); }); - it("Should call Terminology Service URL to fetch value set expansions when manifest Expansion feature flag is true", () => { + it("Should call Terminology Service URL to fetch value set expansions when manifest Expansion feature flag is true and activeOnly is set to 'true' when manifestExpansion is truthy (expansion type is Manifest)", () => { axios.put = jest .fn() .mockResolvedValue({ data: cqm_measure_basic_valueset }); @@ -101,6 +101,32 @@ describe("TerminologyServiceApi Tests", () => { fullUrl: "https://cts.nlm.nih.gov/fhir/Library/mu2-update-2015-05-01", id: "mu2-update-2015-05-01", }, + activeOnly: "true", + profile: "", + valueSetParams: [ + { oid: "2.16.840.1.113883.3.666.5.307" }, + { oid: "2.16.840.1.113883.3.464.1003.103.12.1001" }, + ], + }, + { headers: { Authorization: "Bearer undefined" }, signal: true } + ); + }); + + it("Should call Terminology Service URL to fetch value set expansions when manifest Expansion feature flag is true and activeOnly is set to 'false' when manifestExpansion is falsy (expansion type is Latest)", () => { + axios.put = jest + .fn() + .mockResolvedValue({ data: cqm_measure_basic_valueset }); + const result = terminologyService.getQdmValueSetsExpansion( + cqm_measure_basic, + null, + true + ); + expect(axios.put).toBeCalledWith( + "test.url/terminology/value-sets/expansion/qdm", + { + includeDraft: "yes", + manifestExpansion: null, + activeOnly: "false", profile: "", valueSetParams: [ { oid: "2.16.840.1.113883.3.666.5.307" }, @@ -128,6 +154,7 @@ describe("TerminologyServiceApi Tests", () => { "https://cts.nlm.nih.gov/fhir/Library/mu2-update-2015-05-01", id: "mu2-update-2015-05-01", }, + activeOnly: "true", profile: "", valueSetParams: [ { oid: "2.16.840.1.113883.3.666.5.307" },