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

00672 RewardTransferGraph unit test randomly fails #673

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

ericleponner
Copy link
Collaborator

Description:

Changes below fix a latent issue in HbarAmount unit test causing RewardTransferGraph to break randomly.

HbarAmount defines a mock for api/v1/network/exchangerate at the top level (ie outside of describe() function).
This mock remains active during execution of all the tests.
RewardTransferGraph does not define any mock for api/v1/network/exchangerate and does not expect any dollar values.

When RewardTransferGraph unit test is executed before HbarAmount, it succeeds.
When RewardTransferGraph unit test is executed after, it breaks because HbarAmount mock returns some unexpected dollar values.

Change below make sure that HbarAmount dismantles its mock after its execution.

Related issue(s):

Fixes #672

Notes for reviewer:

It's possible to force vitest to execute HbarAmount before RewardTransferGraph using:

rm -rf  node_modules/.vitest # Clears vitest cache to force alphabetic (?) ordering
npx vitest run --threads false HbarAmount RewardTransferGraph

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@github-actions
Copy link

github-actions bot commented Jul 27, 2023

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 90.8% 29107 / 32056
🔵 Statements 90.8% 29107 / 32056
🔵 Functions 71.67% 726 / 1013
🔵 Branches 84.59% 3392 / 4010
File CoverageNo changed files found.
Generated in workflow #407

@sonarcloud
Copy link

sonarcloud bot commented Jul 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@ericleponner ericleponner merged commit 60353c5 into main Jul 28, 2023
6 checks passed
@ericleponner ericleponner deleted the 00672_RewardTransferGraph_fails branch July 28, 2023 15:38
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.

RewardTransferGraph unit test randomly fails
2 participants