mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-20 22:32:31 +01:00
Added a timeout of 10000 ms to each server test file. This is an attempt to solve the timeout issues that we're experiencing with the Mocha tests. Especially, this is hoping to address the build fails that are caused by such timeouts. Issue is described in https://github.com/meanjs/mean/issues/955
68 lines
1.3 KiB
JavaScript
68 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
var should = require('should'),
|
|
mongoose = require('mongoose'),
|
|
User = mongoose.model('User'),
|
|
Article = mongoose.model('Article');
|
|
|
|
/**
|
|
* Globals
|
|
*/
|
|
var user, article;
|
|
|
|
/**
|
|
* Unit tests
|
|
*/
|
|
describe('Article Model Unit Tests:', function () {
|
|
this.timeout(10000);
|
|
|
|
beforeEach(function (done) {
|
|
user = new User({
|
|
firstName: 'Full',
|
|
lastName: 'Name',
|
|
displayName: 'Full Name',
|
|
email: 'test@test.com',
|
|
username: 'username',
|
|
password: 'M3@n.jsI$Aw3$0m3'
|
|
});
|
|
|
|
user.save(function () {
|
|
article = new Article({
|
|
title: 'Article Title',
|
|
content: 'Article Content',
|
|
user: user
|
|
});
|
|
|
|
done();
|
|
});
|
|
});
|
|
|
|
describe('Method Save', function () {
|
|
it('should be able to save without problems', function (done) {
|
|
this.timeout(10000);
|
|
return article.save(function (err) {
|
|
should.not.exist(err);
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should be able to show an error when try to save without title', function (done) {
|
|
article.title = '';
|
|
|
|
return article.save(function (err) {
|
|
should.exist(err);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
afterEach(function (done) {
|
|
Article.remove().exec(function () {
|
|
User.remove().exec(done);
|
|
});
|
|
});
|
|
});
|