b.collection('movies').find({ director: 'George Lucas' }).toArray(function(error, docs)
~/Documents/home_work$ npm test
> @ test /home/ask/Documents/home_work
> gulp test
[14:39:05] Using gulpfile ~/Documents/home_work/gulpfile.js
[14:39:05] Starting 'test'...
[14:39:05] Finished 'test' after 16 ms
dbInterface
✓ can insert a movie
1) can query data by director
[ { _id: 594271da2bc194af2def0d07,
title: 'Star Wars',
year: 1977,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0a,
title: 'The Phantom Menace',
year: 1999,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0b,
title: 'Attack of the Clones',
year: 2002,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0c,
title: 'Revenge of the Sith',
year: 2005,
director: 'George Lucas' } ]
2) returns multiple results ordered by title
[ { _id: 594271da2bc194af2def0d07,
title: 'Star Wars',
year: 1977,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0a,
title: 'The Phantom Menace',
year: 1999,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0b,
title: 'Attack of the Clones',
year: 2002,
director: 'George Lucas' },
{ _id: 594271da2bc194af2def0d0c,
title: 'Revenge of the Sith',
year: 2005,
director: 'George Lucas' } ]
1 passing (338ms)
2 failing
1) dbInterface can query data by director:
AssertionError: 0 == 1
+ expected - actual
+1
-0
at test.js:41:14
at Object.exports.byDirector (interface.js:19:3)
at Context.<anonymous> (test.js:38:17)
2) dbInterface returns multiple results ordered by title:
AssertionError: 0 == 4
+ expected - actual
+4
-0
at test.js:57:14
at Object.exports.byDirector (interface.js:19:3)
at Context.<anonymous> (test.js:54:17)
Tests failed!