Skip to content

Commit

Permalink
tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
pansbro12 committed Nov 5, 2024
1 parent 4b2f448 commit 473d7f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http"
"time"

"github.com/davecgh/go-spew/spew"

Check failure on line 13 in client.go

View workflow job for this annotation

GitHub Actions / test

"github.com/davecgh/go-spew/spew" imported and not used

Check failure on line 13 in client.go

View workflow job for this annotation

GitHub Actions / test

"github.com/davecgh/go-spew/spew" imported and not used
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
Expand Down
8 changes: 5 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http/httptest"
"testing"

"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -32,6 +33,7 @@ func configureRequest(httpReq *http.Request) *castle.Request {
},
User: castle.User{
ID: "user-id",
Email: "[email protected]",
Traits: map[string]string{"trait1": "traitValue1"},
},
Properties: map[string]string{"prop1": "propValue1"},
Expand Down Expand Up @@ -150,7 +152,7 @@ func TestCastle_Filter(t *testing.T) {
Type castle.EventType `json:"type"`
Status castle.EventStatus `json:"status"`
RequestToken string `json:"request_token"`
User castle.User `json:"user"`
Params castle.UserParams `json:"params"`
Context *castle.Context `json:"context"`
Properties map[string]string `json:"properties"`
}
Expand All @@ -164,13 +166,13 @@ func TestCastle_Filter(t *testing.T) {
assert.True(t, ok)

err = json.NewDecoder(r.Body).Decode(reqData)
spew.Dump(reqData)
require.NoError(t, err)

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

executed = true
Expand Down

0 comments on commit 473d7f1

Please sign in to comment.