mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 01:30:36 +00:00
Test cleanup
This commit is contained in:
@@ -547,4 +547,6 @@ module.exports = function (grunt) {
|
|||||||
'test',
|
'test',
|
||||||
'build'
|
'build'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-mocha-debug');
|
||||||
};
|
};
|
||||||
|
|||||||
8
lib/config/env/test.js
vendored
8
lib/config/env/test.js
vendored
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
env: 'test',
|
env: 'test',
|
||||||
mongo: {
|
mongo: {
|
||||||
uri: 'mongodb://localhost/roboto-test'
|
uri: 'mongodb://localhost/roboto-test'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ var PromotionSchema = new Schema({
|
|||||||
|
|
||||||
/* Indexes */
|
/* Indexes */
|
||||||
PromotionSchema.index({title: 1, user: 1}, {unique: true});
|
PromotionSchema.index({title: 1, user: 1}, {unique: true});
|
||||||
var _model = mongoose.model('Promotion', PromotionSchema);
|
|
||||||
|
|
||||||
/* Operations */
|
/* Operations */
|
||||||
PromotionSchema.statics.findByTitle = function(title, cb){
|
PromotionSchema.statics.findByTitle = function(title, cb){
|
||||||
console.log("findByTitle: " + title);
|
this.findOne({title: title}, cb);
|
||||||
_model.findOne({title: title}, cb);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mongoose.model('Promotion', PromotionSchema);
|
||||||
|
|||||||
@@ -60,7 +60,8 @@
|
|||||||
"open": "~0.0.4",
|
"open": "~0.0.4",
|
||||||
"mocha": "~1.18.2",
|
"mocha": "~1.18.2",
|
||||||
"mongodb": "~1.3.23",
|
"mongodb": "~1.3.23",
|
||||||
"mocha-mongoose": "~1.0.1"
|
"mocha-mongoose": "~1.0.1",
|
||||||
|
"grunt-mocha-debug": "0.0.10"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
|
|||||||
@@ -10,24 +10,24 @@ var user;
|
|||||||
|
|
||||||
describe('Promotion Model', function() {
|
describe('Promotion Model', function() {
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
user = new User({
|
user = new User({
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
name: 'Fake User',
|
name: 'Fake User',
|
||||||
email: 'test@test.com',
|
email: 'test@test.com',
|
||||||
password: 'password'
|
password: 'password'
|
||||||
});
|
});
|
||||||
promotion = new Promotion({
|
promotion = new Promotion({
|
||||||
title: 'Test Prom 1',
|
title: 'Test Prom 1',
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
promotion2 = new Promotion({
|
promotion2 = new Promotion({
|
||||||
title: 'Test Prom 1',
|
title: 'Test Prom 1',
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
// Clear promotions before testing
|
// Clear promotions before testing
|
||||||
Promotion.remove().exec();
|
Promotion.remove().exec();
|
||||||
User.remove().exec();
|
User.remove().exec();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function(done) {
|
afterEach(function(done) {
|
||||||
@@ -75,6 +75,7 @@ describe('Promotion Model', function() {
|
|||||||
});
|
});
|
||||||
describe('Search methods', function(){
|
describe('Search methods', function(){
|
||||||
it('should find promotion by title', function(done){
|
it('should find promotion by title', function(done){
|
||||||
|
debugger;
|
||||||
Promotion.findByTitle('Test Prom 1', function(result){
|
Promotion.findByTitle('Test Prom 1', function(result){
|
||||||
should.exist(result);
|
should.exist(result);
|
||||||
result.title.should.equal('Test Prom 1');
|
result.title.should.equal('Test Prom 1');
|
||||||
|
|||||||
Reference in New Issue
Block a user