-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
47 lines (42 loc) · 1.39 KB
/
client_test.go
File metadata and controls
47 lines (42 loc) · 1.39 KB
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
package astroapi_test
import (
"testing"
astroapi "github.com/astro-api/astroapi-go"
"github.com/astro-api/astroapi-go/option"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewClient_Defaults(t *testing.T) {
client := astroapi.NewClient(option.WithAPIKey("test-key"))
require.NotNil(t, client)
assert.NotNil(t, client.Data)
assert.NotNil(t, client.Charts)
assert.NotNil(t, client.Horoscope)
assert.NotNil(t, client.Analysis)
assert.NotNil(t, client.Glossary)
assert.NotNil(t, client.Astrocartography)
assert.NotNil(t, client.Chinese)
assert.NotNil(t, client.Eclipses)
assert.NotNil(t, client.Lunar)
assert.NotNil(t, client.Numerology)
assert.NotNil(t, client.Tarot)
assert.NotNil(t, client.Traditional)
assert.NotNil(t, client.FixedStars)
assert.NotNil(t, client.Insights)
assert.NotNil(t, client.SVG)
assert.NotNil(t, client.Enhanced)
}
func TestNewClient_InsightsSubClients(t *testing.T) {
client := astroapi.NewClient(option.WithAPIKey("test-key"))
require.NotNil(t, client.Insights)
assert.NotNil(t, client.Insights.Relationship)
assert.NotNil(t, client.Insights.Pet)
assert.NotNil(t, client.Insights.Wellness)
assert.NotNil(t, client.Insights.Financial)
assert.NotNil(t, client.Insights.Business)
}
func TestNewClient_NoKey(t *testing.T) {
// Should not panic even without an API key.
client := astroapi.NewClient()
require.NotNil(t, client)
}