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: test context improvements #606

Merged
merged 3 commits into from
Oct 3, 2024
Merged

Conversation

cylewitruk
Copy link
Member

Description

Pulled this out of my tx-signer branch to help reduce its size/conflicts (I use these changes there).

This PR comes with a number of improvements to how we test using the Context. It was starting to get a little messy with the different Context testing variants -- this addresses that and makes it consistent across the project.

Changes

  • Adds a typestate builder for the TestContext which provides convenience methods for using mocks etc., as well as allowing you to provide your own concrete impls.
  • Adds an automock for StacksInteract.
  • Removed TestSignerContext, NoopApiClient, etc. and refactored everything to use the TestContext and its builder methods.
  • Refactored tests to use TestContext and mocked clients instead of NoopApiClient.

Testing Information

Nothing special as this is test code itself.

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@cylewitruk cylewitruk self-assigned this Oct 3, 2024
@cylewitruk cylewitruk added the sbtc bootstrap signer The sBTC Bootstrap Signer. label Oct 3, 2024
Copy link
Collaborator

@matteojug matteojug left a comment

Choose a reason for hiding this comment

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

Nice!

signer/src/testing/context.rs Outdated Show resolved Hide resolved
signer/src/testing/context.rs Outdated Show resolved Hide resolved
@cylewitruk cylewitruk merged commit 2fa9ce6 into main Oct 3, 2024
4 checks passed
@cylewitruk cylewitruk deleted the feat/test-context-updates branch October 3, 2024 08:40
@matteojug matteojug mentioned this pull request Oct 3, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sbtc bootstrap signer The sBTC Bootstrap Signer.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants