-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuspto_trademark_service_test.go
63 lines (58 loc) · 1.45 KB
/
uspto_trademark_service_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
package go_markerapi_client
import (
"context"
"os"
"testing"
"github.com/joho/godotenv"
"github.com/stretchr/testify/require"
)
func TestIsAvailable(t *testing.T) {
err := godotenv.Load(".env")
require.NoError(t, err)
apiKey := os.Getenv("API_KEY")
if apiKey == "" {
t.Skip("Skip, no API_KEY environment variable found")
}
for _, testCase := range []struct {
name string
searchTerm string
expected bool
errorMessage string
}{
// {
// name: "a known trademark should not be available",
// searchTerm: "google",
// expected: false,
// },
// {
// name: "an unknown trademark should be available",
// searchTerm: "_asdf_",
// expected: true,
// },
// {
// name: "an empty searchTerm should not be available",
// searchTerm: "",
// expected: false,
// errorMessage: "search term is empty",
// },
// {
// name: "happy campers, happy trails",
// searchTerm: "happy campers, happy trails",
// },
{
name: "HAPPY CAMPERS",
searchTerm: "HAPPY CAMPERS",
},
} {
t.Run(testCase.name, func(t *testing.T) {
service := NewUSPTOTradeMarkService(apiKey)
actual, err := service.IsAvailable(context.Background(), testCase.searchTerm)
if testCase.errorMessage != "" {
require.EqualError(t, err, testCase.errorMessage)
} else {
require.NoErrorf(t, err, "Error: %v", err)
}
require.Equal(t, testCase.expected, actual)
})
}
}