test(FilesHooks): add tests for fileMove, fileMovePost, and generate*Activities#2574
Open
miaulalala wants to merge 1 commit intomasterfrom
Open
test(FilesHooks): add tests for fileMove, fileMovePost, and generate*Activities#2574miaulalala wants to merge 1 commit intomasterfrom
miaulalala wants to merge 1 commit intomasterfrom
Conversation
…Activities Covers all previously-untested move/rename paths: - fileMove: .part-file guard, all four moveCase values (rename/moveUp/ moveDown/moveCross), abort when parent fileId is 0 - fileMovePost: early-return when moveCase is false, dispatch to fileRenaming for rename, dispatch to fileMoving for all three move cases; moveCase reset to false after dispatch - generateDeleteActivities / generateAddActivities: empty-users no-op, current-user gets *_self subject, other user gets *_by subject - generateMoveActivities: same no-op/self/by coverage plus the parentId-vs-fileId branch when old and new filenames are equal Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cd8d5cc to
91d022a
Compare
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
Adds 21 tests covering the previously-untested move/rename path in
FilesHooks, which is a prerequisite for safely extracting it into a dedicated class.fileMove:.part-file guard skips lookup; all fourmoveCasevalues set correctly (rename/moveUp/moveDown/moveCross); aborts and setsmoveCase = falsewhen parent file ID is 0fileMovePost: early return whenmoveCaseisfalse; dispatches tofileRenamingfor rename; dispatches tofileMovingfor all three move cases; always resetsmoveCasetofalseafterwardgenerateDeleteActivities/generateAddActivities: empty-users no-op; current user gets*_selfsubject; other user gets*_bysubjectgenerateMoveActivities: same no-op / self / by coverage; plus theparentId-vs-fileIdbranch triggered when old and new filenames are identicalPrivate
getFileChangeActivitySettingsis exercised through its dependencies (UserSettings::filterUsersBySetting,TagManager::getUsersFavoritingObject) rather than being mocked directly.Test plan
🤖 AI-Assisted-By: Claude Sonnet 4.6 noreply@anthropic.com