Files
headscale/tools/bump/git_test.go
T
Kristoffer Dalby 380d1b0d0a tools/bump: carry hand-pushed commits instead of pausing
Open PR with commits by others: rebase onto base, build on top, push
with lease. Rebase conflict pauses and comments once.
2026-10-15 10:50:32 +02:00

28 lines
712 B
Go

package main
import (
"slices"
"testing"
)
// The bot's own commits are rebuilt every run; only someone else's are carried.
func TestNotAuthoredBy(t *testing.T) {
const bot = "41898282+github-actions[bot]@users.noreply.github.com"
log := bot + "\x00flake.lock: update nixpkgs\n" +
"dev@example.com\x00noise: fix deprecation\n" +
bot + "\x00go.mod: update dependencies\n" +
"dev@example.com\x00capver: regenerate\n"
got := notAuthoredBy(log, bot)
want := []string{"noise: fix deprecation", "capver: regenerate"}
if !slices.Equal(got, want) {
t.Errorf("notAuthoredBy = %q, want %q", got, want)
}
if got := notAuthoredBy("", bot); len(got) != 0 {
t.Errorf("empty log carried %q", got)
}
}