@@ -5,21 +5,21 @@ import rql from '../../dist/mongo/rql';
55chai . should ( ) ;
66chai . use ( spies ) ;
77
8- describe ( 'rql' , function ( ) {
9- it ( 'should parse "in"' , function ( ) {
8+ describe ( 'rql' , function ( ) {
9+ it ( 'should parse "in"' , function ( ) {
1010 let query = rql ( { } , { } , 'in(x,a,b,c)' ) ;
1111 query . x . should . deep . equal ( { $in : [ 'a' , 'b' , 'c' ] } ) ;
1212 } ) ;
1313
14- it ( 'should parse "contains"' , function ( ) {
14+ it ( 'should parse "contains"' , function ( ) {
1515 let query = rql ( { } , { } , 'contains(x,aaa)' ) ;
1616 query . x . should . equal ( 'aaa' ) ;
1717
1818 query = rql ( { } , { } , 'contains(x,aaa,bbb,ccc)' ) ;
1919 query . x . should . deep . equal ( [ 'aaa' , 'bbb' , 'ccc' ] ) ;
2020 } ) ;
2121
22- it ( 'should parse "and"' , function ( ) {
22+ it ( 'should parse "and"' , function ( ) {
2323 let query1 = rql ( { } , { } , 'and(eq(x,b))' ) ;
2424 let query2 = rql ( { } , { } , 'eq(x,b)' ) ;
2525 query1 . should . deep . equal ( query2 ) ;
@@ -32,7 +32,7 @@ describe('rql', function() {
3232 query5 . should . deep . equal ( { x : 'b' } ) ;
3333 } ) ;
3434
35- it ( 'should parse "or"' , function ( ) {
35+ it ( 'should parse "or"' , function ( ) {
3636 let query1 = rql ( { } , { } , 'or(eq(x,b))' ) ;
3737 let query2 = rql ( { } , { } , 'eq(x,b)' ) ;
3838 query1 . should . deep . equal ( query2 ) ;
@@ -45,54 +45,58 @@ describe('rql', function() {
4545 query5 . should . deep . equal ( { x : 'b' } ) ;
4646 } ) ;
4747
48- it ( 'should parse "eq"' , function ( ) {
48+ it ( 'should parse "eq"' , function ( ) {
4949 let query = rql ( { } , { } , 'eq(x,a)' ) ;
5050 query . should . deep . equal ( { x : 'a' } ) ;
5151 } ) ;
5252
53- it ( 'should parse "lt"' , function ( ) {
53+ it ( 'should parse "lt"' , function ( ) {
5454 let query = rql ( { } , { } , 'lt(x,a)' ) ;
5555 query . should . deep . equal ( { x : { $lt : 'a' } } ) ;
5656 } ) ;
5757
58- it ( 'should parse "le"' , function ( ) {
58+ it ( 'should parse "le"' , function ( ) {
5959 let query = rql ( { } , { } , 'le(x,a)' ) ;
6060 query . should . deep . equal ( { x : { $lte : 'a' } } ) ;
6161 } ) ;
6262
63- it ( 'should parse "gt"' , function ( ) {
63+ it ( 'should parse "gt"' , function ( ) {
6464 let query = rql ( { } , { } , 'gt(x,a)' ) ;
6565 query . should . deep . equal ( { x : { $gt : 'a' } } ) ;
6666 } ) ;
6767
68- it ( 'should parse "ge"' , function ( ) {
68+ it ( 'should parse "ge"' , function ( ) {
6969 let query = rql ( { } , { } , 'ge(x,a)' ) ;
7070 query . should . deep . equal ( { x : { $gte : 'a' } } ) ;
7171 } ) ;
7272
73- it ( 'should parse "ne"' , function ( ) {
73+ it ( 'should parse "ne"' , function ( ) {
7474 let query = rql ( { } , { } , 'ne(x,a)' ) ;
7575 query . should . deep . equal ( { x : { $ne : 'a' } } ) ;
7676 } ) ;
7777
78- it ( 'should parse "matches"' , function ( ) {
78+ it ( 'should parse "matches"' , function ( ) {
7979 let query = rql ( { } , { } , 'matches(x,a)' ) ;
8080 query . should . deep . equal ( { x : / a / } ) ;
81+ query = rql ( { } , { } , 'matches(x,a,i)' ) ;
82+ query . should . deep . equal ( { x : / a / i } ) ;
83+ query = rql ( { } , { } , 'matches(x,a,ig)' ) ;
84+ query . should . deep . equal ( { x : / a / gi } ) ;
8185 } ) ;
8286
83- it ( 'should parse "sort"' , function ( ) {
87+ it ( 'should parse "sort"' , function ( ) {
8488 let opts : any = { } ;
8589 rql ( { } , opts , 'sort(a,b)' ) ;
8690 opts . sort . should . deep . equal ( [ 'a' , 'b' ] ) ;
8791 } ) ;
8892
89- it ( 'should parse "select"' , function ( ) {
93+ it ( 'should parse "select"' , function ( ) {
9094 let opts : any = { } ;
9195 rql ( { } , opts , 'select(a,b)' ) ;
9296 opts . fields . should . deep . equal ( [ 'a' , 'b' ] ) ;
9397 } ) ;
9498
95- it ( 'should parse "limit"' , function ( ) {
99+ it ( 'should parse "limit"' , function ( ) {
96100 let opts : any = { } ;
97101 rql ( { } , opts , 'limit(a,b)' ) ;
98102 opts . skip . should . equal ( 'a' ) ;
0 commit comments