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

Trying to come with more clarity in tests #1195

Closed
wants to merge 1 commit into from

Conversation

jcrossley3
Copy link
Contributor

No description provided.

@jcrossley3 jcrossley3 requested a review from chirino January 23, 2025 19:57
@jcrossley3
Copy link
Contributor Author

@chirino do we hate this? 😄

assert_eq!(1, matches.len());
assert_eq!(
response.pointer("/items/0/sbom_id"),
response.pointer("/items/0/deps/0/sbom_id")
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't hate it but I do think assuming the array position of the element could be considered brittle. Is that PackageOf relationship pointing at the expected package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You could include additional assertions about the lengths of the relevant arrays like I do in the test below, e.g.

assert!(response.pointer("/items/0/deps/1").is_none());

The PackageOf relationship is asserted on lines 663-666.

I don't like the pointer path as much as your ContainsSubset trait.

@jcrossley3 jcrossley3 closed this Jan 24, 2025
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.

2 participants