Skip to content

Commit

Permalink
AUT-2429: allowing track with nil attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJono committed Dec 6, 2024
1 parent 85d62e5 commit de89ca3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions client/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,29 @@ func TestGetActionWithBadSecret(t *testing.T) {
t.Errorf("Expected error string 'AuthsignalException: 401 - The request is unauthorized. Check that your API key and region base URL are correctly configured.', got '%s'", apiErr.Error())
}
}

func TestTrackWithoutAttributes(t *testing.T) {
client := NewAuthsignalClient(actionTestConfig.apiSecretKey, actionTestConfig.apiUrl)

trackInput := TrackRequest{
UserId: "user123",
Action: "go-sdk-test",
}

trackResponse, err := client.Track(trackInput)
if err != nil {
t.Fatalf("Track failed: %v", err)
}

if trackResponse.State != "CHALLENGE_REQUIRED" {
t.Errorf("Expected State to be 'CHALLENGE_REQUIRED', got %s", trackResponse.State)
}

if trackResponse.IdempotencyKey == "" {
t.Error("Expected IdempotencyKey to be set, got empty string")
}

if trackResponse.Token == "" {
t.Error("Expected Token to be set, got empty string")
}
}

0 comments on commit de89ca3

Please sign in to comment.