diff --git a/users/npm-debug.log b/users/npm-debug.log deleted file mode 100644 index ef50be1..0000000 --- a/users/npm-debug.log +++ /dev/null @@ -1,48 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/local/Cellar/node/7.0.0/bin/node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'run', -1 verbose cli 'test' ] -2 info using npm@3.10.8 -3 info using node@v7.0.0 -4 verbose run-script [ 'pretest', 'test', 'posttest' ] -5 info lifecycle users@1.0.0~pretest: users@1.0.0 -6 silly lifecycle users@1.0.0~pretest: no script for pretest, continuing -7 info lifecycle users@1.0.0~test: users@1.0.0 -8 verbose lifecycle users@1.0.0~test: unsafe-perm in lifecycle true -9 verbose lifecycle users@1.0.0~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/stephengrider/workspace/MongoWorkspace/prod/users/node_modules/.bin:/usr/local/Cellar/node/7.0.0/bin:/Users/stephengrider/.rvm/gems/ruby-2.2.3/bin:/Users/stephengrider/.rvm/gems/ruby-2.2.3@global/bin:/Users/stephengrider/.rvm/rubies/ruby-2.2.3/bin:/Users/stephengrider/.opam/4.02.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/stephengrider/workspace/go/bin:/usr/local/go/bin:/Users/stephengrider/.rvm/bin::/Users/stephengrider/Library/Android/sdk/tools:/Users/stephengrider/Library/Android/sdk/platform-tools -10 verbose lifecycle users@1.0.0~test: CWD: /Users/stephengrider/workspace/MongoWorkspace/prod/users -11 silly lifecycle users@1.0.0~test: Args: [ '-c', 'nodemon --exec \'mocha -R min\'' ] -12 silly lifecycle users@1.0.0~test: Returned: code: 1 signal: null -13 info lifecycle users@1.0.0~test: Failed to exec test script -14 verbose stack Error: users@1.0.0 test: `nodemon --exec 'mocha -R min'` -14 verbose stack Exit status 1 -14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at EventEmitter.emit (events.js:191:7) -14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at ChildProcess.emit (events.js:191:7) -14 verbose stack at maybeClose (internal/child_process.js:877:16) -14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) -15 verbose pkgid users@1.0.0 -16 verbose cwd /Users/stephengrider/workspace/MongoWorkspace/prod/users -17 error Darwin 15.2.0 -18 error argv "/usr/local/Cellar/node/7.0.0/bin/node" "/usr/local/bin/npm" "run" "test" -19 error node v7.0.0 -20 error npm v3.10.8 -21 error code ELIFECYCLE -22 error users@1.0.0 test: `nodemon --exec 'mocha -R min'` -22 error Exit status 1 -23 error Failed at the users@1.0.0 test script 'nodemon --exec 'mocha -R min''. -23 error Make sure you have the latest version of node.js and npm installed. -23 error If you do, this is most likely a problem with the users package, -23 error not with npm itself. -23 error Tell the author that this fails on your system: -23 error nodemon --exec 'mocha -R min' -23 error You can get information on how to open an issue for this project with: -23 error npm bugs users -23 error Or if that isn't available, you can get their info via: -23 error npm owner ls users -23 error There is likely additional logging output above. -24 verbose exit [ 1, true ] diff --git a/users/test/reading_test.js b/users/test/reading_test.js index d82123d..f6e9acd 100644 --- a/users/test/reading_test.js +++ b/users/test/reading_test.js @@ -2,11 +2,15 @@ const assert = require('assert'); const User = require('../src/user'); describe('Reading users out of the database', () => { - let joe; + let joe, maria, alex, zach; beforeEach((done) => { + alex = new User({ name: 'Alex' }); joe = new User({ name: 'Joe' }); - joe.save() + maria = new User({ name: 'Maria' }); + zach = new User({ name: 'Zach' }); + + Promise.all([joe.save(), alex.save(), maria.save(), zach.save()]) .then(() => done()); }); @@ -25,4 +29,17 @@ describe('Reading users out of the database', () => { done(); }); }); + + it('can skip and limit the result set', (done) => { + User.find({}) + .sort({ name: 1 }) + .skip(1) + .limit(2) + .then((users) => { + assert(users.length === 2); + assert(users[0].name === 'Joe'); + assert(users[1].name === 'Maria'); + done(); + }); + }); });