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

#3 Improve test coverage for apps/staking #4

Merged
merged 21 commits into from
Jun 14, 2023

Conversation

nevendyulgerov
Copy link
Contributor

Summary

This PR adds more unit tests for apps/staking with the goal to increase the test coverage to about 75%.

@nevendyulgerov nevendyulgerov self-assigned this May 31, 2023
@vercel
Copy link

vercel bot commented May 31, 2023

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

Name Status Preview Comments Updated (UTC)
rollups ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2023 6:05am
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2023 6:05am

@nevendyulgerov nevendyulgerov added type:refactor A code change that neither fixes a bug nor adds a feature staking Changes targeted to the Staking platform labels May 31, 2023
@nevendyulgerov nevendyulgerov linked an issue May 31, 2023 that may be closed by this pull request
1 task
@coveralls
Copy link

coveralls commented May 31, 2023

Pull Request Test Coverage Report for Build 5240077378

  • 19 of 20 (95.0%) changed or added relevant lines in 11 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+18.8%) to 71.081%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/staking/src/services/apolloENSClient.ts 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
apps/staking/src/services/apolloENSClient.ts 2 0%
Totals Coverage Status
Change from base Build 5172625450: 18.8%
Covered Lines: 2534
Relevant Lines: 3398

💛 - Coveralls

@brunomenezes brunomenezes added type:chore It is not a new feature or bug fix. e.g. update dependencies, change repository configurations type:refactor A code change that neither fixes a bug nor adds a feature and removed type:refactor A code change that neither fixes a bug nor adds a feature type:chore It is not a new feature or bug fix. e.g. update dependencies, change repository configurations labels Jun 5, 2023
@nevendyulgerov nevendyulgerov force-pushed the test/3-improve-test-coverage-for-staking branch from 486d729 to e76051b Compare June 9, 2023 17:34
@nevendyulgerov nevendyulgerov marked this pull request as ready for review June 9, 2023 17:34
@nevendyulgerov nevendyulgerov changed the title [WIP] #3 Improve test coverage for apps/staking #3 Improve test coverage for apps/staking Jun 9, 2023
@brunomenezes
Copy link
Collaborator

@nevendyulgerov ,
The Vercel build is failing because of the missing type. Could you check that?

staking:build:
--
06:21:55.291 | staking:build: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
06:22:08.773 | staking:build: Failed to compile.
06:22:08.774 | staking:build:
06:22:08.774 | staking:build: ./src/pages/stake/[pool]/commissions.tsx:117:64
06:22:08.774 | staking:build: Type error: Property 'value' does not exist on type 'EventTarget & Element'.
06:22:08.774 | staking:build:
06:22:08.774 | staking:build:   115 \|                             onChange={(event) => {
06:22:08.774 | staking:build:   116 \|                                 setRowsPerPage(
06:22:08.774 | staking:build: > 117 \|                                     Number(event.currentTarget.value)
06:22:08.774 | staking:build:       \|                                                                ^
06:22:08.774 | staking:build:   118 \|                                 );
06:22:08.774 | staking:build:   119 \|                                 setPageNumber(0);
06:22:08.775 | staking:build:   120 \|                             }}
06:22:08.849 | staking:build: error Command failed with exit code 1.
06:22:08.849 | staking:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
06:22:08.865 | staking:build: ERROR: command finished with error: command (/vercel/path0/apps/staking) yarn run build exited (1)
06:22:08.865 | command (/vercel/path0/apps/staking) yarn run build exited (1)
06:22:08.865 | ERROR  run failed: command  exited (1)
06:22:08.865 |  
06:22:08.865 | Tasks:    0 successful, 1 total
06:22:08.865 | Cached:    0 cached, 1 total
06:22:08.865 | Time:    27.868s
06:22:08.867 |  
06:22:08.881 | Error: Command "cd ../.. && turbo run build --filter={apps/staking}..." exited with 1
06:22:09.412 | BUILD_UTILS_SPAWN_1: Command "cd ../.. && turbo run build --filter={apps/staking}..." exited with 1

Copy link
Collaborator

@brunomenezes brunomenezes left a comment

Choose a reason for hiding this comment

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

Hey @nevendyulgerov, Good clean-up along the way. However, food for thought here is that there is a bit of a "cheat" like the header links and footer links for the Layout component because if someone mistakenly removes a header link from the array, this test will still pass. It is like implementation detail leaking into the test and driving the expectation making the test intention actually obscure. What are your thoughts?

Nonetheless, I will approve the PR.

@brunomenezes brunomenezes merged commit 286e3a4 into main Jun 14, 2023
4 checks passed
@brunomenezes brunomenezes deleted the test/3-improve-test-coverage-for-staking branch June 14, 2023 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staking Changes targeted to the Staking platform type:refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve test coverage for apps/staking workspace
3 participants