aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/books_test.go
blob: 43a67cfe544157ba0c75e112b1724a1e2e7b3e95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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")
	}
}