@@ -16,51 +16,51 @@ describe('Resolver helper `projection` ->', () => {
1616
1717 it ( 'should not call query.select if projection is empty' , ( ) => {
1818 projectionHelper ( resolveParams ) ;
19- expect ( spyFn ) . not . toBeCalled ( ) ;
19+ expect ( spyFn ) . not . toHaveBeenCalled ( ) ;
2020 } ) ;
2121
2222 it ( 'should call query.select if projection is provided' , ( ) => {
2323 resolveParams . projection = { name : 1 , age : 1 } ;
2424 projectionHelper ( resolveParams , { name : 'n' } ) ;
25- expect ( spyFn ) . toBeCalledWith ( { n : true , age : true } ) ;
25+ expect ( spyFn ) . toHaveBeenCalledWith ( { n : true , age : true } ) ;
2626 } ) ;
2727
2828 it ( 'should make projection fields flat' , ( ) => {
2929 resolveParams . projection = { name : { first : 1 , last : 1 } } ;
3030 projectionHelper ( resolveParams , { name : 'n' } ) ;
31- expect ( spyFn ) . toBeCalledWith ( { 'n.first' : true , 'n.last' : true } ) ;
31+ expect ( spyFn ) . toHaveBeenCalledWith ( { 'n.first' : true , 'n.last' : true } ) ;
3232 } ) ;
3333
3434 it ( 'should make projection fields flat with nested aliases' , ( ) => {
3535 resolveParams . projection = { name : { first : 1 , last : 1 } } ;
3636 projectionHelper ( resolveParams , { name : { __selfAlias : 'n' , first : 'f' , last : 'l' } } ) ;
37- expect ( spyFn ) . toBeCalledWith ( { 'n.f' : true , 'n.l' : true } ) ;
37+ expect ( spyFn ) . toHaveBeenCalledWith ( { 'n.f' : true , 'n.l' : true } ) ;
3838 } ) ;
3939
4040 it ( 'should not call query.select if projection has * key' , ( ) => {
4141 resolveParams . projection = { '*' : true } ;
4242 projectionHelper ( resolveParams ) ;
43- expect ( spyFn ) . not . toBeCalled ( ) ;
43+ expect ( spyFn ) . not . toHaveBeenCalled ( ) ;
4444 } ) ;
4545
4646 describe ( 'projection operators' , ( ) => {
4747 // see more details here https://docs.mongodb.com/v3.2/reference/operator/projection/meta/
4848 it ( 'should pass $meta non-flatten' , ( ) => {
4949 resolveParams . projection = { score : { $meta : 'textScore' } } ;
5050 projectionHelper ( resolveParams ) ;
51- expect ( spyFn ) . toBeCalledWith ( { score : { $meta : 'textScore' } } ) ;
51+ expect ( spyFn ) . toHaveBeenCalledWith ( { score : { $meta : 'textScore' } } ) ;
5252 } ) ;
5353
5454 it ( 'should pass $slice non-flatten' , ( ) => {
5555 resolveParams . projection = { comments : { $slice : 5 } } ;
5656 projectionHelper ( resolveParams ) ;
57- expect ( spyFn ) . toBeCalledWith ( { comments : { $slice : 5 } } ) ;
57+ expect ( spyFn ) . toHaveBeenCalledWith ( { comments : { $slice : 5 } } ) ;
5858 } ) ;
5959
6060 it ( 'should pass $elemMatch non-flatten' , ( ) => {
6161 resolveParams . projection = { students : { $elemMatch : { school : 102 } } } ;
6262 projectionHelper ( resolveParams ) ;
63- expect ( spyFn ) . toBeCalledWith ( { students : { $elemMatch : { school : 102 } } } ) ;
63+ expect ( spyFn ) . toHaveBeenCalledWith ( { students : { $elemMatch : { school : 102 } } } ) ;
6464 } ) ;
6565 } ) ;
6666 } ) ;
0 commit comments