Skip to content

Commit 20c284b

Browse files
committed
Fix up tests for woql.js
1 parent ee7fe07 commit 20c284b

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

test/woql.spec.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,7 @@ describe('woql queries', function () {
226226

227227
const woqlObject=WOQL.get("Map", "Target");
228228

229-
const jsonObj={ get: [
230-
[ { "as": [ {"@value": "T"}, "M" ] },
231-
{ "as": [ {"@value": "a"}, "a" ] },
232-
{ "as": [ { "@value": "r"}, "p" ] }
233-
],
234-
{}
235-
] };
229+
const jsonObj={ get: [[], {}] };
236230

237231
expect(woqlObject.json()).to.eql(jsonObj);
238232

@@ -241,10 +235,14 @@ describe('woql queries', function () {
241235
it('check the as method',function(){
242236

243237
const woqlObject=WOQL.as("Source", "Target");
238+
const woqlObject2=WOQL.as("Source", "Target").as("Source2", "Target2");
244239

245-
const jsonObj={ as: [ { '@value': 'Source' }, 'v:Target' ] };
240+
const jsonObj=[{ as: [ { '@value': 'Source' }, 'v:Target' ] }];
241+
const jsonObj2 =[{ as: [ { '@value': 'Source' }, 'v:Target' ] },
242+
{ as: [ { '@value': 'Source2' }, 'v:Target2' ] }]
246243

247244
expect(woqlObject.json()).to.eql(jsonObj);
245+
expect(woqlObject2.json()).to.eql(jsonObj2);
248246

249247
})
250248

@@ -260,9 +258,9 @@ describe('woql queries', function () {
260258

261259
it('check the unique method',function(){
262260

263-
const woqlObject=WOQL.as("Prefix", ["V1","V2"]);
261+
const woqlObject=WOQL.unique("doc:Station_",["v:Start_ID"],"v:Start_IRI");
264262

265-
const jsonObj={ as: [ { '@value': 'Prefix' }, 'v:V1,V2' ] };
263+
const jsonObj={ unique: [ 'doc:Station_', { list: ["v:Start_ID"] }, 'v:Start_IRI' ] }
266264

267265
expect(woqlObject.json()).to.eql(jsonObj);
268266

@@ -458,7 +456,7 @@ describe('triple builder chanier', function () {
458456

459457
const woqlObject=WOQL.node("doc:x", "add_quad").comment("my comment");
460458

461-
const jsonObj={ add_quad: ['doc:x', 'rdfs:comment', { '@value': 'my comment', '@language': 'en' }, 'db:schema'] };
459+
const jsonObj={ "add_quad": ['doc:x', 'rdfs:comment', { '@value': 'my comment', '@language': 'en' }, 'db:schema'] };
462460

463461
expect(woqlObject.json()).to.eql(jsonObj);
464462

test/woqlQuery.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('pre-roll queries', function () {
4343

4444
const woqlObject=WOQL.limit(2).start(0);
4545
//console.log(woqlObject.getAllDocuments().json());
46-
const jsonObj={ limit: [ 2, { start: [ 0, { "and": [ { "triple": [ "v:Document", "rdf:type", "v:Type"] }, { "sub": ["v:Type", "tcs:Document" ] } ] } ] } ] };
46+
const jsonObj={ limit: [ 2, { start: [ 0, { "and": [ { "triple": [ "v:Subject", "rdf:type", "v:Type"] }, { "sub": ["v:Type", "tcs:Document" ] } ] } ] } ] };
4747

4848
expect(woqlObject.getAllDocuments().json()).to.eql(jsonObj);
4949

@@ -245,9 +245,9 @@ describe('pre-roll queries', function () {
245245
const woqlObject=WOQL.limit(2).start(0);
246246

247247
const jsonObj={ limit: [ 2, { start: [ 0, { "and": [
248-
{ "triple": [ "v:Document", "rdf:type", {"@language": "en", "@value": "ClassID"}] },
248+
{ "triple": [ "v:Subject", "rdf:type", {"@language": "en", "@value": "ClassID"}] },
249249
{ "opt": [ { "triple": [
250-
"v:Document",
250+
"v:Subject",
251251
"v:Property",
252252
"v:Value"
253253
] } ] }
@@ -263,9 +263,9 @@ describe('pre-roll queries', function () {
263263
const woqlObject=WOQL.limit(2).start(0);
264264
//console.log(woqlObject.getAllDocuments().json());
265265
const jsonObj={ limit: [ 2, { start: [ 0, { "and": [
266-
{ "triple": [ "v:Document", "scm:PropID", "v:Value"] },
266+
{ "triple": [ "v:Subject", "scm:PropID", "v:Value"] },
267267
{ "opt": [ { "triple": [
268-
"v:Document",
268+
"v:Subject",
269269
"rdfs:label",
270270
"v:Label"
271271
] } ] }

0 commit comments

Comments
 (0)