* docs: add literary works design and plan * feat(literary): add work link schema * feat(literary): add work domain primitives * feat(literary): persist work links * feat(literary): score work matches * feat(catalog): include literary work summary on item detail * feat(literary): expose work detail API * feat(literary): assemble work detail * feat(literary): add admin work linking primitives * feat(catalog): group literary items by work * feat(literary): auto-link works during book scans * fix(literary): narrow work match candidates * fix(literary): address work merge blockers --------- Co-authored-by: rxwatcher <rxwatcher@users.noreply.github.com> Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com>
23 lines
627 B
Go
23 lines
627 B
Go
package literaryworks
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeKey(t *testing.T) {
|
|
tests := map[string]string{
|
|
"Project Hail Mary": "project hail mary",
|
|
"The Last Adventure: A Novel": "last adventure novel",
|
|
" A Constance-Verity Tale! ": "constance verity tale",
|
|
}
|
|
for input, want := range tests {
|
|
if got := normalizeKey(input); got != want {
|
|
t.Fatalf("normalizeKey(%q) = %q, want %q", input, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestPersonKey(t *testing.T) {
|
|
if got := personKey([]string{" Andy Weir ", "Other"}); got != "andy weir" {
|
|
t.Fatalf("personKey = %q, want primary normalized author", got)
|
|
}
|
|
}
|