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

Refactor brittle test-string in webhooks.test.ts #1816

Open
samayer12 opened this issue Feb 12, 2025 · 0 comments · May be fixed by #1822
Open

Refactor brittle test-string in webhooks.test.ts #1816

samayer12 opened this issue Feb 12, 2025 · 0 comments · May be fixed by #1822

Comments

@samayer12
Copy link
Contributor

Describe what should be investigated or refactored

While working on #1723, I noticed a long JSON string that is parsed as an Assets object. This is brittle and does not support type-safety since data is derived from a string. We should generate this test data in a more procedural/adaptive manner. For example, we could use a generator to create test objects.

Links to any relevant code

webhooks.test.ts

Additional context

github-merge-queue bot pushed a commit that referenced this issue Feb 12, 2025
## Description

We identified a testing gap that exists when a webhook is generated from
an instance of the `Assets` object that has `Assets.host` defined. This
test case addresses that gap.

**NOTE**: There's some tight coupling with the `Assets` class and the
use of a massive JSON string to create our test `assets` object in this
file. Resolving those issue are outside the scope of this PR but do need
to be addressed by future work. See #1816 and #1817

## Related Issue

Fixes #1723

## 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
- [x] 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
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed
@tamirazrab tamirazrab linked a pull request Feb 13, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

1 participant