From 94dae83c4a57919da428471507bc100470d2690a Mon Sep 17 00:00:00 2001 From: Jackson Morgan Date: Fri, 21 Feb 2025 15:18:12 -0500 Subject: [PATCH] Will not create a set when not described by the context --- .../jsonld-dataset-proxy/src/subjectProxy/getValueForKey.ts | 4 +--- .../jsonld-dataset-proxy/test/jsonldDatasetProxy.test.ts | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/jsonld-dataset-proxy/src/subjectProxy/getValueForKey.ts b/packages/jsonld-dataset-proxy/src/subjectProxy/getValueForKey.ts index 5244e30..ecf23ec 100644 --- a/packages/jsonld-dataset-proxy/src/subjectProxy/getValueForKey.ts +++ b/packages/jsonld-dataset-proxy/src/subjectProxy/getValueForKey.ts @@ -52,13 +52,11 @@ export function getValueForKey( } if (objectDataset.size === 0) { return undefined; - } else if (objectDataset.size === 1) { + } else { const thing = nodeToJsonldRepresentation( objectDataset.toArray()[0].object, proxyContext, ); return thing; - } else { - return proxyContext.createSetProxy([subject, predicate, null, null]); } } diff --git a/packages/jsonld-dataset-proxy/test/jsonldDatasetProxy.test.ts b/packages/jsonld-dataset-proxy/test/jsonldDatasetProxy.test.ts index a39aa19..f60e79e 100644 --- a/packages/jsonld-dataset-proxy/test/jsonldDatasetProxy.test.ts +++ b/packages/jsonld-dataset-proxy/test/jsonldDatasetProxy.test.ts @@ -544,9 +544,13 @@ const testJsonldDatasetProxy = (patientContext: LdoJsonldContext) => () => { it("Creates a blank node if the id is blank during set", async () => { const [dataset, observation] = await getEmptyObservationDataset(); observation.type = { "@id": "Observation" }; + console.log("1"); observation.subject = { type: { "@id": "Patient" }, name: set("Joe") }; + console.log("2"); expect(observation.subject?.["@id"]).toBeUndefined(); - expect(observation.subject.name).toEqual(["Joe"]); + console.log("here"); + expect(observation.subject.name).toContain("Joe"); + console.log("there"); expect( dataset .match(