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

feat: overhaul connector tests #3138

Merged
merged 1 commit into from
Jan 12, 2021
Merged

Conversation

joshgummersall
Copy link
Contributor

  • provide OAuth/JWT stub helpers
  • expand JWT token validation tests
  • reorg existing auth tests
  • remove unnecessary assertExt helpers.

The bulk of this work is to protect me from inadvertent bugs caused by the incoming CloudAdapter port work. In particular, having a way to stub and test JWT/Oauth end-to-end with full signature verification is handy.

@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 2 times, most recently from 81904f6 to cf3952b Compare December 9, 2020 23:16
@coveralls
Copy link

coveralls commented Dec 9, 2020

Pull Request Test Coverage Report for Build 480958776

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 35 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+0.09%) to 84.479%

Files with Coverage Reduction New Missed Lines %
libraries/botframework-connector/src/auth/appCredentials.ts 1 90.91%
libraries/botframework-connector/src/auth/governmentChannelValidation.ts 2 89.13%
libraries/botframework-connector/src/auth/microsoftAppCredentials.ts 2 77.78%
libraries/botframework-connector/src/auth/jwtTokenValidation.ts 6 88.89%
libraries/botframework-connector/src/auth/emulatorValidation.ts 10 73.4%
libraries/botframework-connector/src/auth/jwtTokenExtractor.ts 14 71.68%
Totals Coverage Status
Change from base Build 480938929: 0.09%
Covered Lines: 17807
Relevant Lines: 20138

💛 - Coveralls

@microsoft microsoft deleted a comment from coveralls Dec 9, 2020
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 3 times, most recently from 25d193f to c2f71c1 Compare December 11, 2020 21:57
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch from c2f71c1 to bc269cb Compare December 11, 2020 22:22
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch from bc269cb to 35593c3 Compare December 11, 2020 22:36
@@ -0,0 +1,127 @@
// Copyright (c) Microsoft Corporation.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This magically allows us to fully stub JWT in the tests.

@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this the Oauth flow, including fully signed and verifiable JWTs (using the above stub).

@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 6 times, most recently from 09c8bf3 to 73cf9ce Compare December 14, 2020 20:09
@joshgummersall joshgummersall requested a review from a team as a code owner December 14, 2020 20:09
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 2 times, most recently from 63aa200 to f4e6f76 Compare December 14, 2020 22:30
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch from f4e6f76 to 172354e Compare December 23, 2020 17:34
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 2 times, most recently from ac376b3 to 1216a29 Compare December 29, 2020 17:53
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch 3 times, most recently from c0a9476 to cb0a5f8 Compare January 7, 2021 21:25
- provide oauth/jwt stub helpers in new test utils package
- expand jwt token validation tests
- reorg existing auth tests
- remove unnecessary `assertExt` helpers.
- JSDoc cleanup, code formatting, etc.
@joshgummersall joshgummersall force-pushed the jpg/add-bf-connector-tests branch from cb0a5f8 to 600c059 Compare January 12, 2021 18:39
Copy link
Member

@stevengum stevengum left a comment

Choose a reason for hiding this comment

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

This looks very solid. Should this PR be crosslinked with microsoft/botframework-sdk#5977 for the new botbuilder-test-utils nock-ing code?

@joshgummersall joshgummersall merged commit 84ad6f7 into main Jan 12, 2021
@joshgummersall joshgummersall deleted the jpg/add-bf-connector-tests branch January 12, 2021 19:41
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