Skip to content

add missing unit tests for #2108 - #2227

Closed
benkroeger wants to merge 2 commits into
strongloop:masterfrom
benkroeger:hotfix/issue-2226
Closed

add missing unit tests for #2108#2227
benkroeger wants to merge 2 commits into
strongloop:masterfrom
benkroeger:hotfix/issue-2226

Conversation

@benkroeger

Copy link
Copy Markdown
Contributor

subsequent token middleware tries to read token.id when enableDoublecheck: true. That caused a "Cannot read property id of null" error when the first middleware didn't actually find a valid accessToken.

@bajtos

fixes #2226

subsequent token middleware tries to read `token.id` when `enableDoublecheck: true`. That caused a "Cannot read property `id` of `null`" error when the first middleware didn't actually find a valid accessToken.
@slnode

slnode commented Apr 13, 2016

Copy link
Copy Markdown

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@bajtos

bajtos commented Apr 13, 2016

Copy link
Copy Markdown
Member

@slnode ok to test

Comment thread test/access-token.test.js
.expect(200)
.end(function(err, res) {
if (err) return done(err);
expect(res.body).to.eql({

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.

Is it necessary to check all token properties here? I am worried that if we add a new Token property in the future, we will have to fix way too many tests that don't really depend on specific Token properties.

It think it is enough to check that res.body.id is the same as token.id, isn't it?

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.

in my last unit test, I did exactly that - and you commented that only checking on id wouldn't be enough.
Let me know which one you prefer

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.

I see, sorry for me not being consistent! Let's keep what you have now.

@bajtos

bajtos commented Apr 13, 2016

Copy link
Copy Markdown
Member

@benkroeger thank you for the pull request. The patch looks good in general, I pointed out two details to improve in the comments above.

@bajtos bajtos self-assigned this Apr 13, 2016
@bajtos

bajtos commented Jun 13, 2016

Copy link
Copy Markdown
Member

Landed via 103935c, thank you for the contribution!

bajtos pushed a commit that referenced this pull request Jun 13, 2016
Subsequent token middleware tries to read `token.id`
when `enableDoublecheck: true`.
That caused a "Cannot read property `id` of `null`" error
when the first middleware didn't actually find a valid accessToken.

[back-port of #2227]
@benkroeger
benkroeger deleted the hotfix/issue-2226 branch August 15, 2016 11:15
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.

Add missing unit test for token middleware

4 participants