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: refactor watch processor test to reduce redundancy #1763

Conversation

tamirazrab
Copy link
Contributor

Description

Resolve max-statements warning in src/lib/processors/watch-processor.test.ts
...

End to End Test:
(See Pepr Excellent Examples)

Related Issue

Fixes #1696

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.11%. Comparing base (517bbd6) to head (38d8821).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1763   +/-   ##
=======================================
  Coverage   82.11%   82.11%           
=======================================
  Files          52       52           
  Lines        2214     2214           
  Branches      470      469    -1     
=======================================
  Hits         1818     1818           
- Misses        367      394   +27     
+ Partials       29        2   -27     

see 7 files with indirect coverage changes

@samayer12 samayer12 changed the title [WIP] : chore(wip): refactor watch processor test to reduce redundancy chore: refactor watch processor test to reduce redundancy Feb 6, 2025
@samayer12
Copy link
Contributor

@tamirazrab I took at look at the test refactor and noticed there was an issue with resetting mocks between assertions. I reintroduced the manual mock-resets to get the tests to pass. As a follow-on item, we should consider the use of it.each() for the capabilities that are tested and more generally examine how we're using mocks in the test suite.

Copy link
Contributor

@samayer12 samayer12 left a comment

Choose a reason for hiding this comment

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

Improving the test quality here can take multiple PRs, which is okay. This PR extracts the repeated assertions into a helper function used by a test.

@samayer12 samayer12 requested a review from cmwylie19 February 7, 2025 16:41
@cmwylie19 cmwylie19 enabled auto-merge February 7, 2025 16:45
@cmwylie19 cmwylie19 added this pull request to the merge queue Feb 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 7, 2025
@samayer12 samayer12 enabled auto-merge February 7, 2025 17:33
@samayer12 samayer12 added this pull request to the merge queue Feb 7, 2025
Merged via the queue into defenseunicorns:main with commit 129376b Feb 7, 2025
44 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Resolve max-statements warning in src/lib/processors/watch-processor.test.ts
3 participants