Skip to content

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

Closed
hacksparrow wants to merge 1 commit into
strongloop:masterfrom
hacksparrow:update/loopback2
Closed

hacksparrow wants to merge 1 commit into
strongloop:masterfrom
hacksparrow:update/loopback2

Conversation

@hacksparrow

Copy link
Copy Markdown
Member

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

Comment thread test/middleware.test.js

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.

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

bajtos commented Sep 21, 2015

Copy link
Copy Markdown
Member

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