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

feat(articles): Simple test enhancement #1659

Merged
merged 2 commits into from
Jun 13, 2017

Conversation

jrodenbostel
Copy link
Contributor

feat(articles): Simple test enhancement

Simple test enhancement proposed by @jrodenbostel. Eases troubleshooting when Article save fails during test execution.

Further reference here: meanjs/generator-meanjs#257

Fixes #1658

Simple test enhancement proposed by @jrodenbostel.  Eases troubleshooting when Article save fails during test execution.

Further reference here: meanjs/generator-meanjs#257

Fixes meanjs#1658
@jloveland
Copy link
Contributor

looks good

@@ -306,7 +306,10 @@ describe('Article CRUD tests', function () {
var articleObj = new Article(article);

// Save the article
articleObj.save(function () {
articleObj.save(function (err) {
if (err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrodenbostel If the intention is to catch/handle unexpected (possibly random) errors here, then why not just fail the test when err exists? This test should only pass when all conditions and expectations are met, right?

Maybe I'm thinking about it wrong. I guess we have two options, either we assert that err doesn't exist to fail the test when it does exist, or we pass the err to the callback to propagate the actual error back to the test runner; perhaps, the former solves both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent was only to make diagnosing test failures easier when the failure is related to the article not being saved. When that save fails, the definitely fails, just not in a clear way.

Nothing crazy, but dealing with that was a enough of a hassle at the time to motivate me to submit this patch.

articleObj.save(function () {
articleObj.save(function (err) {
if (err) {
done(err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be return done(err); instead.

Copy link
Member

@codydaig codydaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once @simison's issue is addressed I think it will be ready for merging.

@lirantal
Copy link
Member

@meanjs/contributors can you guys keep an eye on this PR. if it doesn't get addressed in a week or so let's just re-PR it and merge so we don't have many stale PRs.

@jrodenbostel
Copy link
Contributor Author

@codydaig I just pushed the requested changes.

@simison
Copy link
Member

simison commented Jun 13, 2017

LGTM 👍

@codydaig
Copy link
Member

LGTM

@mleanos Look good to you?

@lirantal
Copy link
Member

👍

@mleanos
Copy link
Member

mleanos commented Jun 13, 2017

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants