You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: