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

Changed TokenController._createEthersContract to no longer be async #895

Merged
merged 4 commits into from
Sep 6, 2022

Conversation

BelfordZ
Copy link
Contributor

@BelfordZ BelfordZ commented Aug 24, 2022

TokensController touch ups

The main change in this PR is removal of async from the TokensController._createEthersContract interface, since it does not make any async calls, it does not need to return a promise.

Description

  • BREAKING:

    • _createEthersContract, though prefixed with an underscore, is very much a public function that could be used by others. That said, no longer returning a promise could be considered a breaking change.
  • FIXED:

    • Clean up use of sinon
      • keep track of stubs and directly restore vs. using global sinon.restore and hoping for the best.
      • prefer jest mocks over sinon in select places
      • add better typing to TokensController._createEthersContract
      • restore clock / sinon.useFakeTimers manually for to maintain sanity
  • REMOVED:

    1. call to tokensController._getNewAllTokensState from tests.
  • ADDED:

    • create mock / test helper for TokenController (for now only mocking createEthersContract).
      • More DRY testing code, easy to build upon

Checklist

  • [ x ] Tests are included if applicable
  • [ x ] Any added code is fully documented

@BelfordZ BelfordZ requested a review from a team as a code owner August 24, 2022 03:09
@BelfordZ BelfordZ marked this pull request as draft August 24, 2022 03:10
@BelfordZ BelfordZ marked this pull request as ready for review August 24, 2022 07:24
@BelfordZ BelfordZ force-pushed the refactor-token-controller branch 2 times, most recently from 996fcdf to eea0498 Compare August 24, 2022 07:36
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Good change — just had a few suggestions.

@BelfordZ BelfordZ requested review from mcmire and Gudahtt August 24, 2022 19:00
@BelfordZ BelfordZ force-pushed the refactor-token-controller branch from b1ba397 to e6da46d Compare August 24, 2022 19:42
@BelfordZ BelfordZ requested a review from mcmire August 25, 2022 18:43
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@BelfordZ BelfordZ merged commit e977bff into main Sep 6, 2022
@BelfordZ BelfordZ deleted the refactor-token-controller branch September 6, 2022 17:54
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…895)

* Changed TokenController._createEthersContract to no longer be async

* Fixed code review issues

* Fixed linting issues

* Changed createEthersStub to be defined in the file it is used
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…895)

* Changed TokenController._createEthersContract to no longer be async

* Fixed code review issues

* Fixed linting issues

* Changed createEthersStub to be defined in the file it is used
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