Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update middleware.test.js to take loopback#rest into consideration #114

Closed
wants to merge 1 commit into from

Conversation

hacksparrow
Copy link
Member

loopback#rest is expected to be present by default because of strongloop/loopback-workspace#230

@@ -91,7 +91,7 @@ describe('loopback:middleware generator', function() {
var newSources = Object.keys(
readMiddlewaresJsonSync('server')['routes:after']);
var expectedSources = builtinSources.concat(['my-middleware-4']);
expect(newSources).to.have.members(expectedSources);
expect(expectedSources).to.have.include.members(newSources);
Copy link
Member

Choose a reason for hiding this comment

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

This looks rather weird to me. The argument of expect() is always the actual value as observed by the test, not the value we are expecting to see. Why is this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

newSources refers to an array with the name of a single middleware - my-middleware-4, which is added for this test.

expectedSources refers to an array with the default loopback#rest and my-middleware-4, which was added for the test.

How do you suggest this assertion be composed?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bajtos ping!

Copy link
Member

Choose a reason for hiding this comment

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

You should fix L88-L89 and set builtinSource to the content of routes:after phase instead of current routes phase. After that, expectedSources should contain both default loopback#rest and added my-middleware-4.

Copy link
Member

Choose a reason for hiding this comment

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

To be honest, I am confused - it seems that the CI build is passing this test even with the new version of loopback-workspace after strongloop/loopback-workspace#230 was landed.

@bajtos
Copy link
Member

bajtos commented Sep 21, 2015

Closing in favour of #115.

@bajtos bajtos closed this Sep 21, 2015
@bajtos bajtos removed the #review label Sep 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants