test: guard sprint promote-to-draft button rules and editor body adoption - #5362
Merged
Conversation
…tion (#5300) The promote-to-draft feature shipped in eaab0bd without the two client regression guards its plan called for. ExercisePanel.test.jsx pins the button visibility predicate (finished, has text, matches the open work, not already promoted), the dirty-editor disabled state, and the success/failure callbacks. WorkEditor.test.jsx pins the widened body-sync guard: a clean editor adopts a server-pushed activeDraftBody, a dirty one keeps the writer's buffer. Verified non-vacuous by reverting the guard - the adoption case then fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes #5300. The promote-a-finished-sprint-to-the-draft feature shipped in
eaab0bd05, but without two of the regression guards the issue's acceptance criteria called for — so this diff is test-only; no product behavior changes.ExercisePanel.test.jsx(new) — pins the "Add to draft" visibility predicate (finished, has captured text, belongs to the open work, not already promoted), the promoted-row marker, theeditorDirtydisabled state and its "Save first" hint, and both the success and failure callbacks.WorkEditor.test.jsx— pins the widened body-sync guard: a clean editor adopts a server-pushedactiveDraftBody, a dirty one keeps the writer's unsaved buffer. That guard decides whether a sibling panel's server-side append can clobber in-progress typing, and it was the riskiest untested part of the original change.Each assertion was checked against a mutated component to confirm it fails when the behavior it names is removed, rather than passing incidentally.
Closes #5300
Test plan
cd client && npm test— 807 files / 10192 tests pass.cd server && npm test— 1721 files / 35366 tests pass (unchanged; diff is client-only).cd client && npm run lint— clean.hasNewCleanBodyfrom theWorkEditorbody-sync guard fails the adoption test.ex.status === 'finished'from theExercisePanelpredicate fails the running-sprint case.wordsAddedinstead ofcountWords(appendedText)for the success toast fails the success-path test.