Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #599 from loulin/0.4.0
Browse files Browse the repository at this point in the history
Add return for done(err) in test
  • Loading branch information
ilanbiala committed Jul 9, 2015
2 parents 11b37f2 + d00f4ce commit ade074c
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions modules/articles/tests/server/article.server.routes.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
if (signinErr) {
return done(signinErr);
}

// Get the userId
var userId = user.id;
Expand All @@ -71,13 +73,17 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (articleSaveErr, articleSaveRes) {
// Handle article save error
if (articleSaveErr) done(articleSaveErr);
if (articleSaveErr) {
return done(articleSaveErr);
}

// Get a list of articles
agent.get('/api/articles')
.end(function (articlesGetErr, articlesGetRes) {
// Handle article save error
if (articlesGetErr) done(articlesGetErr);
if (articlesGetErr) {
return done(articlesGetErr);
}

// Get articles list
var articles = articlesGetRes.body;
Expand Down Expand Up @@ -112,7 +118,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
if (signinErr) {
return done(signinErr);
}

// Get the userId
var userId = user.id;
Expand All @@ -137,7 +145,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
if (signinErr) {
return done(signinErr);
}

// Get the userId
var userId = user.id;
Expand All @@ -148,7 +158,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (articleSaveErr, articleSaveRes) {
// Handle article save error
if (articleSaveErr) done(articleSaveErr);
if (articleSaveErr) {
return done(articleSaveErr);
}

// Update article title
article.title = 'WHY YOU GOTTA BE SO MEAN?';
Expand All @@ -159,7 +171,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (articleUpdateErr, articleUpdateRes) {
// Handle article update error
if (articleUpdateErr) done(articleUpdateErr);
if (articleUpdateErr) {
return done(articleUpdateErr);
}

// Set assertions
(articleUpdateRes.body._id).should.equal(articleSaveRes.body._id);
Expand Down Expand Up @@ -227,7 +241,9 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
if (signinErr) {
return done(signinErr);
}

// Get the userId
var userId = user.id;
Expand All @@ -238,15 +254,19 @@ describe('Article CRUD tests', function () {
.expect(200)
.end(function (articleSaveErr, articleSaveRes) {
// Handle article save error
if (articleSaveErr) done(articleSaveErr);
if (articleSaveErr) {
return done(articleSaveErr);
}

// Delete an existing article
agent.delete('/api/articles/' + articleSaveRes.body._id)
.send(article)
.expect(200)
.end(function (articleDeleteErr, articleDeleteRes) {
// Handle article error error
if (articleDeleteErr) done(articleDeleteErr);
if (articleDeleteErr) {
return done(articleDeleteErr);
}

// Set assertions
(articleDeleteRes.body._id).should.equal(articleSaveRes.body._id);
Expand Down

0 comments on commit ade074c

Please sign in to comment.