Rapid Diffs: Strengthen FOUC prevention test to assert on startup JS content

Summary

The FOUC prevention test in spec/components/rapid_diffs/merge_request_app_component_spec.rb currently asserts that a <script> tag exists in the rendered component, but does not verify the actual content of the script. This means the test would still pass even if the script contents were accidentally emptied or changed to something non-functional.

Proposal

Strengthen the test to assert that the rendered <script> tag contains expected JavaScript content (e.g., the customElements.define call or key identifiers from the startup script).

This was identified during review of !222771 (merged).

References

  • MR where this was identified: !222771 (merged)
  • Test file: spec/components/rapid_diffs/merge_request_app_component_spec.rb
  • Relevant spec: "includes startup_js for FOUC prevention when user is logged in"
Edited Mar 02, 2026 by Thomas Randolph
Assignee Loading
Time tracking Loading