forked from ahamidi/conduit-connector-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdestination_test.go
42 lines (34 loc) · 1.04 KB
/
destination_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
package connector_test
import (
"context"
connector "github.com/ahamidi/conduit-connector-template"
"strings"
"testing"
)
func TestConfigureDestination_FailsWhenConfigEmpty(t *testing.T) {
con := connector.Destination{}
err := con.Configure(context.Background(), make(map[string]string))
if err != nil {
t.Errorf("expected no error, got %v", err)
}
if strings.HasPrefix(err.Error(), "config is invalid:") {
t.Errorf("expected error to be about missing config, got %v", err)
}
}
func TestConfigureDestination_FailsWhenConfigInvalid(t *testing.T) {
con := connector.Destination{}
err := con.Configure(context.Background(), map[string]string{"foobar": "foobar"})
if err != nil {
t.Errorf("expected no error, got %v", err)
}
if strings.HasPrefix(err.Error(), "config is missing:") {
t.Errorf("expected error to be about invalid config, got %v", err)
}
}
func TestTeardown_NoOpen(t *testing.T) {
con := connector.NewDestination()
err := con.Teardown(context.Background())
if err != nil {
t.Errorf("expected no error, got %v", err)
}
}