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

fix: Re-request wallet stats #2947

Merged
merged 5 commits into from
Oct 6, 2023
Merged

fix: Re-request wallet stats #2947

merged 5 commits into from
Oct 6, 2023

Conversation

fzavalia
Copy link
Contributor

@fzavalia fzavalia commented Oct 5, 2023

On clear deployment and deployment success

@vercel
Copy link

vercel bot commented Oct 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
builder ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 6, 2023 3:08pm

@coveralls
Copy link

coveralls commented Oct 5, 2023

Pull Request Test Coverage Report for Build 6433283166

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 17.647%

Totals Coverage Status
Change from base Build 6432949052: 0.02%
Covered Lines: 3619
Relevant Lines: 16465

💛 - Coveralls

describe('when there is an address in the store', () => {
it('should put the request action to fetch worlds wallet stats with the stored address', () => {
return expectSaga(worldsSaga)
.provide([[select(getAddress), address]])
Copy link
Contributor

Choose a reason for hiding this comment

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

As expectSaga runs the saga until completion and, when testing handleActionsThatTriggerFetchWorldsWalletStatsRequest, the fetchWorldsWalletStatsRequest action is put and, taking into consideration that the sagas also handles that action, the fetchWorldsWalletStatsRequest should be ran as well. To prevent this, we can mock the put:

Suggested change
.provide([[select(getAddress), address]])
.provide([[select(getAddress), address], [put(fetchWorldsWalletStatsRequest(address)), undefined]])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm certain that is unnecessary due to the nature of sagas.

fetchWorldsWalletStatsRequest will be handled by the saga yes, but it will not proceed on any undeclared effect.

For example, it will run and stop were said in the code:

function* handlefetchWorldsWalletStatsRequest(action: FetchWalletWorldsStatsRequestAction) {
  const { address } = action.payload

  try {
    // Stops here given that the call is not declared in the test
    const stats: WorldsWalletStats | null = yield call([WorldsAPIContent, WorldsAPIContent.fetchWalletStats], address)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Besides if I set the request put in the .provide, it will not call the .put that comes afterwards, making the test not declaratively useful given that the things tested are what comes after the .provide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm mistaken with this, updated it per your suggestion

@fzavalia fzavalia merged commit 62eedde into master Oct 6, 2023
7 checks passed
@fzavalia fzavalia deleted the fix/re-request-wallet-stats branch October 6, 2023 15:23
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.

None yet

3 participants