@@ -4,15 +4,15 @@ const { describe } = require('ava-spec');
44const test = require ( 'ava' ) ;
55const mongooseCursorPaginate = require ( '../src/mongoose.plugin' ) ;
66
7- let MONGO_URI = 'mongodb://127.0.0.1/mongoose_paginate' ;
7+ const MONGO_URI = 'mongodb://127.0.0.1/mongoose_paginate' ;
88
9- let AuthorSchema = new mongoose . Schema ( { name : String } ) ;
9+ const AuthorSchema = new mongoose . Schema ( { name : String } ) ;
1010
1111AuthorSchema . plugin ( mongooseCursorPaginate , { name : 'paginateFN' } ) ;
1212
13- let Author = mongoose . model ( 'Author' , AuthorSchema ) ;
13+ const Author = mongoose . model ( 'Author' , AuthorSchema ) ;
1414
15- let PostSchema = new mongoose . Schema ( {
15+ const PostSchema = new mongoose . Schema ( {
1616 title : String ,
1717 date : Date ,
1818 body : String ,
@@ -24,7 +24,7 @@ let PostSchema = new mongoose.Schema({
2424
2525PostSchema . plugin ( mongooseCursorPaginate ) ;
2626
27- let Post = mongoose . model ( 'Post' , PostSchema ) ;
27+ const Post = mongoose . model ( 'Post' , PostSchema ) ;
2828
2929test . before ( 'start mongoose connection and add data into collection' , async ( ) => {
3030 await mongoose . connect ( MONGO_URI ) ;
@@ -33,7 +33,7 @@ test.before('start mongoose connection and add data into collection', async () =
3333
3434 let post ,
3535 posts = [ ] ;
36- let date = new Date ( ) ;
36+ const date = new Date ( ) ;
3737
3838 for ( let i = 1 ; i <= 100 ; i ++ ) {
3939 post = new Post ( {
@@ -50,17 +50,17 @@ test.before('start mongoose connection and add data into collection', async () =
5050
5151describe ( 'mongoose plugin' , ( it ) => {
5252 it ( 'paginate function should initialized by provided name' , function ( t ) {
53- let promise = Author . paginateFN ( ) ;
53+ const promise = Author . paginateFN ( ) ;
5454 t . is ( promise . then instanceof Function , true ) ;
5555 } ) ;
5656
5757 it ( 'return promise' , function ( t ) {
58- let promise = Post . paginate ( ) ;
58+ const promise = Post . paginate ( ) ;
5959 t . is ( promise . then instanceof Function , true ) ;
6060 } ) ;
6161
6262 it ( 'should return data in expected format' , async function ( t ) {
63- let data = await Post . paginate ( ) ;
63+ const data = await Post . paginate ( ) ;
6464 t . is ( data . hasOwnProperty ( 'results' ) , true ) ;
6565 t . is ( data . hasOwnProperty ( 'previous' ) , true ) ;
6666 t . is ( data . hasOwnProperty ( 'hasPrevious' ) , true ) ;
0 commit comments