From bef6c01f4408cce8cfcc2c1a375a20380de09c03 Mon Sep 17 00:00:00 2001 From: sahalali Date: Mon, 5 Aug 2024 12:27:49 +0530 Subject: [PATCH] Added more unit tests --- src/constant/recon-queries.constants.ts | 2 +- src/service/recon/recon.service.spec.ts | 117 +++++++++++++++++++++++- 2 files changed, 116 insertions(+), 3 deletions(-) diff --git a/src/constant/recon-queries.constants.ts b/src/constant/recon-queries.constants.ts index 1f5ab5e..42bb4b0 100644 --- a/src/constant/recon-queries.constants.ts +++ b/src/constant/recon-queries.constants.ts @@ -30,7 +30,7 @@ WHERE luc:entities ?entity . PROPERTY_PLACE_HOLDER - FILTER (CONTAINS(STR(?entity),"kg.artsdata.ca/resource/K")) + FILTER (CONTAINS(STR(?entity),"kg.artsdata.ca/resource/")) ?entity luc:score ?score; # a ?type_additional. diff --git a/src/service/recon/recon.service.spec.ts b/src/service/recon/recon.service.spec.ts index 45589b7..281459d 100644 --- a/src/service/recon/recon.service.spec.ts +++ b/src/service/recon/recon.service.spec.ts @@ -223,7 +223,118 @@ describe("Recon Service tests", () => { ], expectedName: "Dance", expectedCount: 1 + }, + { + description: "Reconcile a Place with Artsdata ID", + "queries": [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "K11-19" + } + ] + } + ], + expectedName: "Roy Thomson Hall", + expectedCount: 1 + }, { + description: "Reconcile Place with Artsdata URI", + "queries": [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "http://kg.artsdata.ca/resource/K11-19" + } + ] + }] + , + expectedName: "Roy Thomson Hall", + expectedCount: 1 + }, { + description: "Reconcile Place with Name", + "queries": [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "Roy Thomson Hall" + } + ] + } + ], + expectedName: "Roy Thomson Hall", + expectedCount: 1 + }, + { + description: "Reconcile Place with Name", + "queries": [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "Roy Thomson Hall" + } + ] + } + ], + expectedName: "Roy Thomson Hall", + expectedCount: 1 + }, { + description: "Reconcile Place with Name and Postal code", + "queries": [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "Roy Thomson" + }, { + "matchType": "property", + "v": "M5J 2H5", + "pid": "schema:address/schema:postalCode", + "required": true + } + ] + } + ], + expectedName: "Roy Thomson Hall", + expectedCount: 1 + }, + { + description: "Reconcile Place with Name and Street Address", + queries: + [ + { + "type": "schema:Place", + "limit": 1, + "conditions": [ + { + "matchType": "name", + "v": "Roy Thomson" + }, { + "matchType": "property", + "v": "60 Simcoe Street", + "pid": "schema:address/schema:streetAddress", + "required": true + } + ] + } + ], + expectedName: "Roy Thomson Hall", + expectedCount: 1 } + ]; for (const test of testCases) { @@ -246,7 +357,9 @@ describe("Recon Service tests", () => { }); } - }); + }) + ; -}); +}) +;