aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/books_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/bible/books_test.go')
-rw-r--r--internal/bible/books_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/bible/books_test.go b/internal/bible/books_test.go
new file mode 100644
index 0000000..43a67cf
--- /dev/null
+++ b/internal/bible/books_test.go
@@ -0,0 +1,26 @@
+package bible
+
+import "testing"
+
+func TestResolveBook(t *testing.T) {
+ cases := []struct{ in, want string }{
+ {"John", "John"},
+ {"Joh", "John"}, // English prefix
+ {"J", "John"}, // Polish abbrev — NOT Joshua
+ {"Łk", "Luke"},
+ {"1 Kor", "1 Corinthians"},
+ {"Jana", "John"},
+ {"Rodzaju", "Genesis"},
+ {"Mdr", "Wisdom"},
+ {"Pnp", "Song of Solomon"},
+ {"Dz", "The Acts"},
+ }
+ for _, c := range cases {
+ if got, ok := ResolveBook(c.in); !ok || got != c.want {
+ t.Errorf("ResolveBook(%q)=%q,%v want %q", c.in, got, ok, c.want)
+ }
+ }
+ if _, ok := ResolveBook("Nonsense"); ok {
+ t.Error("ResolveBook(Nonsense) should fail")
+ }
+}