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

Replace done w/ async part 5 (final PR for this) #3436

Merged
merged 4 commits into from
Mar 26, 2021

Conversation

mdrichardson
Copy link
Contributor

@mdrichardson mdrichardson commented Mar 24, 2021

Note: Even though this basically only covers botbuilder-connector, this is the last PR on this issue and everything that can be easily converted now has been.

Fixes #3226

Covers

(Alphabetically such that botbuilder comes before botbuilder-)

  • botbuilder-dialogs-adaptive through end, inclusive

Excludes

  • mocha before/after hooks in connector.test.js
  • All tests in botframework-streaming. Many rely on callbacks and don't work when converted.

Description

Replaces the use of done() in tests with proper async/await.

Specific Changes

  • done => async/await
  • Remove some of the try/catches that are no longer needed since we don't need done(err)
  • Avoid arrow function in mocha tests
  • A lot of no-op stuff auto-fixes with our prettier/eslint settings

@@ -134,7 +134,7 @@ export class DialogTestClient {
* Send an activity into the dialog.
*
* ```javascript
* DialogTest.send('hello').assertReply('hello yourself').then(done);
* await DialogTest.send('hello').assertReply('hello yourself').startTest();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: Figured I may as well make the comments show the "right" way.

});
it('should fail with invalid conversatoinId', function(done) {
var params = createConversation();
it('should fail with invalid conversationId', async function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: Renaming this test required this file to be renamed, below: Bot_Framework_Connector_SDK_Conversations_GetActivityMembers_should_fail_with_invalid_conversationId.nock.js

@mdrichardson mdrichardson changed the title done to async in tests Replace done w/ async part 5 (final PR for this) Mar 24, 2021
@coveralls
Copy link

coveralls commented Mar 24, 2021

Pull Request Test Coverage Report for Build 684548287

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 85.033%

Totals Coverage Status
Change from base Build 684494096: 0.006%
Covered Lines: 18786
Relevant Lines: 21040

💛 - Coveralls

@mdrichardson mdrichardson marked this pull request as ready for review March 24, 2021 21:50
@mdrichardson mdrichardson requested a review from a team as a code owner March 24, 2021 21:50
@joshgummersall joshgummersall merged commit abd7879 into microsoft:main Mar 26, 2021
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.

Use async tests instead of done(), where possible
3 participants