Commit 2b18c97 1 parent 924895f commit 2b18c97 Copy full SHA for 2b18c97
File tree 5 files changed +21
-7
lines changed
5 files changed +21
-7
lines changed Original file line number Diff line number Diff line change
1
+ import neo4jDriver from 'neo4j-driver' ;
1
2
import { expect } from 'chai' ;
2
3
import { Limit } from './limit' ;
3
4
@@ -6,7 +7,7 @@ describe('Limit', () => {
6
7
it ( 'should add a produce a limit clause' , ( ) => {
7
8
const query = new Limit ( 10 ) ;
8
9
expect ( query . build ( ) ) . to . equal ( 'LIMIT $limitCount' ) ;
9
- expect ( query . getParams ( ) ) . to . eql ( { limitCount : 10 } ) ;
10
+ expect ( query . getParams ( ) ) . to . eql ( { limitCount : neo4jDriver . int ( 10 ) } ) ;
10
11
} ) ;
11
12
} ) ;
12
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import neo4jDriver from 'neo4j-driver' ;
1
2
import { Clause } from '../clause' ;
2
3
import { Parameter } from '../parameter-bag' ;
3
4
@@ -6,7 +7,7 @@ export class Limit extends Clause {
6
7
7
8
constructor ( public amount : number ) {
8
9
super ( ) ;
9
- this . amountParam = this . addParam ( amount , 'limitCount' ) ;
10
+ this . amountParam = this . addParam ( neo4jDriver . int ( amount ) , 'limitCount' ) ;
10
11
}
11
12
12
13
build ( ) {
Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
+ import neo4jDriver from 'neo4j-driver' ;
2
3
import { Skip } from './skip' ;
3
4
4
5
describe ( 'Skip' , ( ) => {
5
6
describe ( '#build' , ( ) => {
6
7
it ( 'should add a produce a skip clause' , ( ) => {
7
8
const query = new Skip ( 10 ) ;
8
9
expect ( query . build ( ) ) . to . equal ( 'SKIP $skipCount' ) ;
9
- expect ( query . getParams ( ) ) . to . eql ( { skipCount : 10 } ) ;
10
+ expect ( query . getParams ( ) ) . to . eql ( { skipCount : neo4jDriver . int ( 10 ) } ) ;
10
11
} ) ;
11
12
} ) ;
12
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import neo4jDriver from 'neo4j-driver' ;
1
2
import { Clause } from '../clause' ;
2
3
import { Parameter } from '../parameter-bag' ;
3
4
@@ -6,7 +7,7 @@ export class Skip extends Clause {
6
7
7
8
constructor ( public amount : number ) {
8
9
super ( ) ;
9
- this . amountParam = this . addParam ( amount , 'skipCount' ) ;
10
+ this . amountParam = this . addParam ( neo4jDriver . int ( amount ) , 'skipCount' ) ;
10
11
}
11
12
12
13
build ( ) {
Original file line number Diff line number Diff line change 1
- import { neo4jCredentials , neo4jUrl , waitForNeo } from './utils' ;
2
- import { Connection } from '../src' ;
3
- import { expect } from '../test-setup' ;
4
1
import { Dictionary , isNil } from 'lodash' ;
2
+ import { Connection } from '../src' ;
5
3
import { node , relation } from '../src/clauses' ;
4
+ import { expect } from '../test-setup' ;
5
+ import { neo4jCredentials , neo4jUrl , waitForNeo } from './utils' ;
6
6
7
7
function expectResults (
8
8
results : any [ ] ,
@@ -108,6 +108,16 @@ describe('scenarios', () => {
108
108
} ) ;
109
109
} ) ;
110
110
111
+ it ( 'should fetch a single node using limit' , async ( ) => {
112
+ const results = await db . matchNode ( 'person' , 'Person' )
113
+ . return ( 'person' )
114
+ . skip ( 1 )
115
+ . limit ( 1 )
116
+ . run ( ) ;
117
+
118
+ expectResults ( results , 1 , [ 'person' ] ) ;
119
+ } ) ;
120
+
111
121
it ( 'should fetch a property of a set of nodes' , async ( ) => {
112
122
const results = await db . matchNode ( 'person' , 'Person' )
113
123
. return ( { 'person.age' : 'yearsOld' } )
You can’t perform that action at this time.
0 commit comments