Skip to content

Commit b323356

Browse files
committed
put all tests for woql.js excecpt result api
1 parent 6ac8d16 commit b323356

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

test/woql.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ describe('woql queries', function () {
8383
const woqlObject=WOQL.when(true, WOQL.addClass("id"));
8484

8585
const woqlObjectChain=WOQL.when(true).addClass("id")
86-
console.log(woqlObject.json());
8786

8887
const jsonObj={
8988
when: [
@@ -223,9 +222,9 @@ describe('woql queries', function () {
223222

224223
it('check the get method',function(){
225224

226-
const woqlObject=WOQL.as("Map", "Target");
225+
const woqlObject=WOQL.get("Map", "Target");
227226

228-
const jsonObj={ as: [ { '@value': 'Map' }, 'v:Target' ] };
227+
const jsonObj={ get: [ 'Map' , 'Target' ] };
229228

230229
expect(woqlObject.json()).to.eql(jsonObj);
231230

test/woqlQuery.spec.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,4 +598,56 @@ describe('woql query object', function () {
598598

599599
})
600600

601+
it('check the getLimit method',function(){
602+
global.sandbox.stub(axios, "get").returns(Promise.resolve({status:200, data: {}}));
603+
604+
const woqlObject=WOQL.limit(2).start(0);
605+
606+
expect(woqlObject.getLimit()).to.eql(2);
607+
608+
})
609+
610+
it('check the hasSelect method',function(){
611+
global.sandbox.stub(axios, "get").returns(Promise.resolve({status:200, data: {}}));
612+
613+
const woqlObjectTrue=WOQL.select("V1", WOQL.triple("a", "b", "c"));
614+
const woqlObjectFalse=WOQL.limit(2).start(0);
615+
616+
expect(woqlObjectTrue.hasSelect()).to.eql(true);
617+
expect(woqlObjectFalse.hasSelect()).to.eql(false);
618+
619+
})
620+
621+
it('check the getSelect method',function(){
622+
global.sandbox.stub(axios, "get").returns(Promise.resolve({status:200, data: {}}));
623+
624+
const woqlObject=WOQL.select("V1", WOQL.triple("a", "b", "c"));
625+
626+
expect(woqlObject.getSelect()).to.eql("V1");
627+
628+
})
629+
630+
it('check the context method',function(){
631+
global.sandbox.stub(axios, "get").returns(Promise.resolve({status:200, data: {}}));
632+
633+
const woqlObject=WOQL.limit(2).start(0);
634+
635+
//const jsonObj={ limit: [ 3, { start: [ 0, {} ] } ] };
636+
console.log(woqlObject.context("context").json())
637+
638+
//expect(woqlObject.setContext("context").json()).to.eql(jsonObj);
639+
640+
})
641+
642+
it('check the getContext method',function(){
643+
global.sandbox.stub(axios, "get").returns(Promise.resolve({status:200, data: {}}));
644+
645+
const woqlObject=WOQL.context("context");
646+
647+
const jsonObj={ limit: [ 3, { start: [ 0, {} ] } ] };
648+
649+
expect(woqlObject.getContext()).to.eql(jsonObj);
650+
651+
})
652+
601653
});

0 commit comments

Comments
 (0)