diff options
Diffstat (limited to 'common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures')
4 files changed, 140 insertions, 0 deletions
diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/config.js b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/config.js new file mode 100644 index 0000000..bdb1208 --- /dev/null +++ b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/config.js @@ -0,0 +1,32 @@ +var express = require('express'), + fixtures = require('pow-mongodb-fixtures'), + app = require('../../examples/movies/'), + data = require('./data'), + done = false, + mongoose, + callback; + + +exports.app = app; +exports.movie = app.movie; +exports.user = app.user; +exports.review = app.review +mongoose = app.mongoose; +fixtures = fixtures.connect(mongoose.connection.name); + +fixtures.load(data, function(err) { + exports.users = data.users; + exports.movies = data.movies; + exports.reviews = data.reviews; + done = true; + if (callback) return callback(); +}); + +exports.movies = data.movies; +exports.users = data.users; +exports.reviews = data.reviews; + +exports.ready = function(cb) { + callback = cb; + if (done) callback(); +}; diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/data.js b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/data.js new file mode 100644 index 0000000..7beafd9 --- /dev/null +++ b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/data.js @@ -0,0 +1,101 @@ +var ObjectId = require('mongodb').ObjectID; + +exports.users = [ + { + _id: new ObjectId(), + username: "test", + pass_hash: 12374238719845134515, + }, + { + _id: new ObjectId(), + username: "test2", + pass_hash: 1237987381263189273123, + } +]; + +exports.movies = [ + { + _id: new ObjectId(), + title: "Title1", + year: 2012, + meta: { + productionco: "idk", + director: exports.users[1]._id, + }, + creator: exports.users[0]._id, + secret: "A SECRET STRING", + }, + { + _id: new ObjectId(), + title: "Title2", + year: 2011 + }, + { + _id: new ObjectId(), + title: "Title3", + year: 2013 + }, + { + _id: new ObjectId(), + title: "Title4", + year: 2013 + }, + { + _id: new ObjectId(), + title: "Title5", + year: 2013 + }, + { + _id: new ObjectId(), + title: "Title6", + year: 2010 + }, + { + _id: new ObjectId(), + title: "Title7", + year: 2011 + }, + { + _id: new ObjectId(), + title: "Title8", + year: 2012 + }, + { + _id: new ObjectId(), + title: "Title9", + year: 2010 + }, + { + _id: new ObjectId(), + title: "Title10", + year: 2011 + }, + { + _id: new ObjectId(), + title: "Title11", + year: 2012 + }, + { + _id: new ObjectId(), + title: "Title12", + year: 2010 + }, + { + _id: new ObjectId(), + title: "Title13", + year: 2011 + }, + { + _id: new ObjectId(), + title: "Title14", + year: 2009 + } +]; + +exports.reviews = [ + { + _id: new ObjectId(), + body: "This is a movie review!", + length: 127 + } +]; diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/index.jade b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/index.jade new file mode 100644 index 0000000..a17ae31 --- /dev/null +++ b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/index.jade @@ -0,0 +1,4 @@ +h1 index + +each item, i in locals + li #{item.title}: #{i} diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/show.jade b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/show.jade new file mode 100644 index 0000000..7cb6b3c --- /dev/null +++ b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/fixtures/movies/show.jade @@ -0,0 +1,3 @@ +h1 show + +#{title} |