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

Potential Test Coverage Gap for TitleBarComponent's Edge Case Rendering #451

Closed
techvoyagerX opened this issue Sep 30, 2024 · 1 comment
Closed

Comments

@techvoyagerX
Copy link

It looks like the test file test/phoenix/live_dashboard/components/title_bar_component_test.exs is doing a good job of covering the basics, but I think we’re missing some edge cases here. Specifically, it might be worth testing:

  • Negative and Over-Max Percentages: Right now, the percent key is tested with 0.1, but what happens if percent is either below 0 or exceeds 1? We should add tests for those boundary values, especially since they could affect how the width in the style tag is rendered.

  • Empty or Malformed Nonces: The test currently provides nonces for img, style, and script, but what happens if one of these nonces is nil, an empty string, or missing entirely? Handling these cases gracefully is crucial, particularly from a security standpoint when dealing with CSP policies.

  • No inner_block Handling: While the test currently checks the presence of an inner_block, it doesn't verify how the component behaves if inner_block is missing. We should ensure the component doesn't break or fail to render in such scenarios.

Fleshing out these cases could help prevent subtle bugs from slipping through in the future.

Also, as a small point, there seems to be a minor typo in the assertion: div class="test-class". I think it’s missing an opening <, but that might just be an oversight in test readability.

Looking forward to your thoughts!

@josevalim
Copy link
Member

Closing in favor of the PR #452

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

No branches or pull requests

2 participants