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

increase coverage in mutate-processor #1892

Closed
cmwylie19 opened this issue Mar 4, 2025 · 0 comments · Fixed by #1897
Closed

increase coverage in mutate-processor #1892

cmwylie19 opened this issue Mar 4, 2025 · 0 comments · Fixed by #1897
Assignees

Comments

@cmwylie19
Copy link
Contributor

Describe what should be investigated or refactored

mutate processor is missing tests.

  mutate-processor.ts        |   64.89 |       75 |      60 |   65.59 | 143-217  

We need to increase coverage to ensure the right functions are being called during calls to mutateProcessor to ensure the the requests will be skipped if the criteria is wrong, the requests are measured in terms of the webhookTimeout, and secrets are converted from base64.

@cmwylie19 cmwylie19 self-assigned this Mar 4, 2025
github-merge-queue bot pushed a commit that referenced this issue Mar 6, 2025
## Description

This is very hard to test because the Capability does not have actual
bindings. Because of that the test stops
[here](https://github.com/defenseunicorns/pepr/blob/4e8549a43bb911072bd0316f7dace7172e5eb1a0/src/lib/processors/mutate-processor.ts#L197)
and returns early. The only meaningful tests I could do was to ensure
the timer start and stop were called.

There is already too much mocking in this file I cannot get any
assertions to pass for base64 calls here.

**UPDATE**: was able to validate the first decodeData was called by
shuffling files around and mocking the call in `mutate-process.test.ts`.
The rest of the test is untestable due to no bindings in the
capabilities

Needs #1895 to pass.

## Related Issue

Fixes #1892 
<!-- or -->
Relates to #

## Type of change

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

## Checklist before merging
- [ ] Unit,
[Journey](https://github.com/defenseunicorns/pepr/tree/main/journey),
[E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples),
[docs](https://github.com/defenseunicorns/pepr/tree/main/docs),
[adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or
updated as needed
- [ ] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <[email protected]>
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Pepr Project Board Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant