Skip to content

test: added shape of setup function and its arguments - #110

Open
gabrieledm wants to merge 6 commits into
mainfrom
chore/gabrieledm/tests/reduce-tron-tech-debth
Open

test: added shape of setup function and its arguments#110
gabrieledm wants to merge 6 commits into
mainfrom
chore/gabrieledm/tests/reduce-tron-tech-debth

Conversation

@gabrieledm

Copy link
Copy Markdown
Contributor

Explanation

First PR for refactor of tests under packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts to remove the usage of beforeEach and follow the Unit Testing Guidelines

To split the PRs is used the Stacked pull requests feature from GitHub

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

ulissesferreira
ulissesferreira previously approved these changes Aug 4, 2026
import type { TransactionsRepository } from './TransactionsRepository';
import { TransactionsService } from './TransactionsService';

type WithTransactionServiceCallback = <ReturnValue>(payload: {}) =>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will lead to a lint problem but it's normal since I only added the shape of the setup function and it's arguments.
In the next PRs the setup function will be used and the lint problems is not fired

ulissesferreira pushed a commit that referenced this pull request Aug 5, 2026
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Seventh PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
ulissesferreira pushed a commit that referenced this pull request Aug 5, 2026
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Sixth PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
ulissesferreira pushed a commit that referenced this pull request Aug 5, 2026
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Fifth PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
ulissesferreira pushed a commit that referenced this pull request Aug 5, 2026
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Fourth PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
ulissesferreira pushed a commit that referenced this pull request Aug 5, 2026
…sts (#113)

## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Third PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

Second PR of Stacked pull requests to remove the usage of `beforeEach`
and follow the [Unit Testing Guidelines

](https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#avoid-the-use-of-beforeeach)
in the file
`packages/tron-wallet-snap/src/services/transactions/TransactionsService.test.ts`.

The base PR is: #110

To split the PRs is used the [Stacked pull
requests](https://docs.github.com/en/pull-requests/reference/stacked-pull-requests)
feature from GitHub

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
);

expect(true).toBe(true);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(mockTransactionsRepository.saveMany).toHaveBeenCalledWith(
fetchedTransactions,
);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(mockTransactionsRepository.saveMany).toHaveBeenCalledWith(
mockTransactions,
);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(mockTransactionsRepository.saveMany).toHaveBeenCalledWith([]);
expect(true).toBe(true);
expect(mockTransactionsRepository.saveMany).toHaveBeenCalledWith([]);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(mockTransactionsRepository.saveMany).toHaveBeenCalledWith(
mockTransactions,
);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(
mockTransactionsRepository.findByAccountId,
).not.toHaveBeenCalled();
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

mockTransactionsRepository.findByAccountId,
).toHaveBeenCalledWith(mockAccount2.id);
expect(result).toHaveLength(2);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

'[🧾 TransactionsService]',
'Failed to fetch TRC20 transactions for address TGJn1wnUYHJbvN88cynZbsAz2EMeZq73yx on network tron:728126428',
);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

expect(result).toStrictEqual([]);
expect(true).toBe(true);
expect(result).toStrictEqual([]);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

).toHaveBeenCalledWith(Network.Shasta, mockAccount.address);

expect(true).toBe(true);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

);

expect(true).toBe(true);
expect(true).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be removed

const transactionsService: TransactionsService = new TransactionsService({
logger: mockLogger,
transactionsRepository:
mockTransactionsRepository as unknown as TransactionsRepository,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not entirely sure, so investigate this with a time limit, but I think you should be able to not have to cast this as unknown to pass it in. I think either the mock is incomplete, and we could have it in a shared mocks place, or maybe the type of the AssetsService could get a tweak? Or maybe you are leaving those changes for another PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The goal of this PR is to remove the beforeEach usage so honestly I didn't pay attention to this topi.
Anyway we can definitely create separate PRs dedicated to this.

jeremytsng pushed a commit that referenced this pull request Aug 5, 2026
…nd update fee multiplier (#110)

## Explanation

This PR adjusts keyring transaction typing for Stellar trustline (change-trust) operations and changes how on-chain account sync emits balance and asset-list updates to resolve client sync/reconciliation issues.

<img width="535" height="541" alt="image"
src="https://github.com/user-attachments/assets/59294196-a48d-44d5-ac48-24c813c87e7a"
/>


<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants