-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheditions_test.go
94 lines (78 loc) · 1.87 KB
/
editions_test.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package gol_test
import (
"testing"
"github.com/Open-pi/gol"
)
func TestGetEdition(t *testing.T) {
_, err := gol.GetEdition("OL0000000")
if err == nil {
t.Error("GetEdition did not return an err when calling an inexistent book")
}
}
func TestGetEditionISBN(t *testing.T) {
t.Parallel()
tt1 := []struct {
name string
input string
}{
{"Incorrect ISBN ID Length", "9984"},
{"Incorrect ISBN-13 ID prefix", "9870140328721"},
{"Inexistent ISBN/Book", "9780140328725"},
}
for _, tc := range tt1 {
tc := tc // capture range variable
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
_, err := gol.GetEditionISBN(tc.input)
if err == nil {
t.Fatalf("GetEditionISBN(%s) did not return an error for incorrect/inexistent ISBN", tc.input)
}
})
}
}
func TestEditionKeyAuthors(t *testing.T) {
t.Parallel()
t.Run("Existing Author", func(t *testing.T) {
t.Parallel()
b, _ := gol.GetEdition("OL4554174M")
_, ok := b.KeyAuthors()
if ok != nil {
t.Fatalf("KeyAuthors() did not return authors for an existing book")
}
})
t.Run("Non-Existing Author", func(t *testing.T) {
t.Parallel()
b, _ := gol.GetEdition("OL0000000M")
_, ok := b.KeyAuthors()
if ok == nil {
t.Fatalf("KeyAuthors() did not return an error for non existing book")
}
})
}
func TestKeyCovers(t *testing.T) {
}
func TestEditionGoodReads(t *testing.T) {
}
func TestEditionISBN(t *testing.T) {
}
func TestEditionSubjects(t *testing.T) {
}
func TestEditionPublishers(t *testing.T) {
}
func TestEditionTitle(t *testing.T) {
}
func TestEditionWorkKeys(t *testing.T) {
}
func TestEditionNumberOfPages(t *testing.T) {
}
/*
//func TestEditionAuthors(t *testing.T) {
//tr, err := editions[0].Authors()
//if err != nil {
//t.Errorf("b.Authors() returned an error, %v expecting an Authors slice", err)
//}
//if !cmp.Equal(tr, authors) {
//t.Errorf("Expected set of authors incorrect")
//}
//}
*/