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

chore(storage-browser): Update control unit tests to be more isolated #6194

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

cshfang
Copy link
Member

@cshfang cshfang commented Nov 21, 2024

Description of changes

This PR streamlines the control unit tests to isolate its mocks a bit better so that it is not implicitly testing upstream dependent components

Issue #, if available

Description of how you validated changes

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, e2e, examples, or other private packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@cshfang cshfang requested a review from a team as a code owner November 21, 2024 23:20
Copy link

changeset-bot bot commented Nov 21, 2024

⚠️ No Changeset found

Latest commit: 5da2670

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@jordanvn jordanvn left a comment

Choose a reason for hiding this comment

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

These changes mstm. Confirmed no regressions locally, and for this improves overall coverage as well.


const expected: DataRefreshProps = {
isDisabled: data.isDataRefreshDisabled,
onRefresh: expect.any(Function),
Copy link
Member

Choose a reason for hiding this comment

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

we could consider using mock onRefresh from line 19, possibly expect onRefresh: mockOnRefresh instead of any function. this applies to a lot of the other tests, but i don't think it's critical.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I had considered doing this but we'd have to pull them out into const mockOnRefresh = jest.fn() just to assert something that's more or less trivial in the end. So just opted to keep it marginally more concise

@cshfang cshfang merged commit d827f03 into main Nov 25, 2024
35 checks passed
@cshfang cshfang deleted the chore/streamline-unit-tests branch November 25, 2024 22:48
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