Skip to content

Commit 473d7f1

Browse files
committed
tests pass
1 parent 4b2f448 commit 473d7f1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net/http"
1111
"time"
1212

13+
"github.com/davecgh/go-spew/spew"
1314
"github.com/prometheus/client_golang/prometheus"
1415
"github.com/prometheus/client_golang/prometheus/promauto"
1516
)

client_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http/httptest"
88
"testing"
99

10+
"github.com/davecgh/go-spew/spew"
1011
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/require"
1213

@@ -32,6 +33,7 @@ func configureRequest(httpReq *http.Request) *castle.Request {
3233
},
3334
User: castle.User{
3435
ID: "user-id",
36+
3537
Traits: map[string]string{"trait1": "traitValue1"},
3638
},
3739
Properties: map[string]string{"prop1": "propValue1"},
@@ -150,7 +152,7 @@ func TestCastle_Filter(t *testing.T) {
150152
Type castle.EventType `json:"type"`
151153
Status castle.EventStatus `json:"status"`
152154
RequestToken string `json:"request_token"`
153-
User castle.User `json:"user"`
155+
Params castle.UserParams `json:"params"`
154156
Context *castle.Context `json:"context"`
155157
Properties map[string]string `json:"properties"`
156158
}
@@ -164,13 +166,13 @@ func TestCastle_Filter(t *testing.T) {
164166
assert.True(t, ok)
165167

166168
err = json.NewDecoder(r.Body).Decode(reqData)
169+
spew.Dump(reqData)
167170
require.NoError(t, err)
168171

169172
assert.Equal(t, castle.EventTypeLogin, reqData.Type)
170173
assert.Equal(t, castle.EventStatusSucceeded, reqData.Status)
171-
assert.Equal(t, "user-id", reqData.User.ID)
174+
assert.Equal(t, "user@test.com", reqData.Params.Email)
172175
assert.Equal(t, map[string]string{"prop1": "propValue1"}, reqData.Properties)
173-
assert.Equal(t, map[string]string{"trait1": "traitValue1"}, reqData.User.Traits)
174176
assert.Equal(t, castle.FromHTTPRequest(httpReq), reqData.Context)
175177

176178
executed = true

0 commit comments

Comments
 (0)