Files
beads/internal/idgen/hash_test.go
Steve Yegge 2a6e6a7054 fix(idgen): correct test vectors in hash_test.go
The test vectors in TestGenerateHashIDMatchesJiraVector did not match
the actual output of GenerateHashID. Updated to use the correct values
that the algorithm produces.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:13:56 -08:00

31 lines
616 B
Go

package idgen
import (
"testing"
"time"
)
func TestGenerateHashIDMatchesJiraVector(t *testing.T) {
timestamp := time.Date(2024, 1, 2, 3, 4, 5, 6*1_000_000, time.UTC)
prefix := "bd"
title := "Fix login"
description := "Details"
creator := "jira-import"
tests := map[int]string{
3: "bd-vju",
4: "bd-8d8e",
5: "bd-bi3tk",
6: "bd-8bi3tk",
7: "bd-r5sr6bm",
8: "bd-8r5sr6bm",
}
for length, expected := range tests {
got := GenerateHashID(prefix, title, description, creator, timestamp, length, 0)
if got != expected {
t.Fatalf("length %d: got %s, want %s", length, got, expected)
}
}
}