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

feat(articles): Simple test enhancement#1659

Merged
mleanos merged 2 commits into
meanjs:masterfrom
jrodenbostel:simple-test-enhancement
Jun 13, 2017
Merged

feat(articles): Simple test enhancement#1659
mleanos merged 2 commits into
meanjs:masterfrom
jrodenbostel:simple-test-enhancement

Conversation

@jrodenbostel
Copy link
Copy Markdown
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
Copy Markdown
Contributor

looks good

// Save the article
articleObj.save(function () {
articleObj.save(function (err) {
if (err) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

@codydaig I just pushed the requested changes.

@simison
Copy link
Copy Markdown
Contributor

simison commented Jun 13, 2017

LGTM 👍

@codydaig
Copy link
Copy Markdown
Member

LGTM

@mleanos Look good to you?

@lirantal
Copy link
Copy Markdown
Member

👍

@mleanos
Copy link
Copy Markdown
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