Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/box/prreview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@ func TestAReviewIsMadeAtTheConfirmedCommitAndNothingElse(t *testing.T) {
if got := headOf(t, wt.Path); got != sha {
t.Fatalf("the review moved by itself to %s", got)
}
// Updating to a commit the reviewer was not shown is refused.
if _, err := f.b.UpdateReview(context.Background(), "app", ReviewUpdate{Location: "shop", Worktree: "review-42", SHA: sha[:39] + "0"}); codeOf(err) != "moved" {
// Updating to a commit the reviewer was not shown is refused. The unseen
// one differs in its last digit, whatever that digit is: one commit in
// sixteen already ends in 0.
unseen := sha[:39] + "0"
if unseen == sha {
unseen = sha[:39] + "1"
}
if _, err := f.b.UpdateReview(context.Background(), "app", ReviewUpdate{Location: "shop", Worktree: "review-42", SHA: unseen}); codeOf(err) != "moved" {
t.Fatalf("update to an unseen commit: %v", err)
}
// With uncommitted changes it stays put.
Expand Down
Loading