Draft: Add full-mount spec for Rapid Diffs discussion note shapes

What does this MR do and why?

This MR adds a full-mount Jest spec for Rapid Diffs discussion_notes.vue. The spec mounts the whole note tree without stubs, and feeds it note shapes that the real legacyNotes Pinia store produces: persisted replies, the optimistic reply placeholder, and the quick-action placeholder.

The existing discussion_notes_spec.js uses shallowMount, so a crash in a child component is invisible. This spec catches the missing placeholder branch in the Rapid Diffs component: the placeholder has no author, and noteable_note.vue throws TypeError: Cannot read properties of undefined (reading 'id'). Vue 2 swallows this error and renders a blank component. Vue 3 in the development build rethrows it and breaks the whole discussion list. The bug was found only after the Vue 3 migration of the MR Rapid Diffs page had merged, and the migration was reverted.

Full-mount specs with store-produced shapes let Jest catch this class of crash before a Vue 3 migration flag is enabled, instead of feature specs on master. This spec is a template for other migration targets.

This MR is a Draft. On master, the two placeholder cases fail under Vue 2 and Vue 3. Merge it after the fix in !255075 (merged).

References

Screenshots or screen recordings

This MR has no UI change.

How to set up and validate locally

Run the spec under both Vue versions. On master, expect 2 failures in each run:

  • yarn jest spec/frontend/rapid_diffs/app/discussions/discussion_notes_store_shapes_spec.js
  • VUE_VERSION=3 yarn jest spec/frontend/rapid_diffs/app/discussions/discussion_notes_store_shapes_spec.js

Apply the component files from the fix MR:

git fetch origin tor/rapid-diffs/placeholder-note-vue3-compat
git checkout FETCH_HEAD -- app/assets/javascripts/rapid_diffs/app/discussions

Rerun both commands. Expect 3 passes in each run.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading