github.com/clerkinc/clerk-sdk-go@v1.49.1/tests/integration/clients_test.go (about)

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestClients(t *testing.T) {
    11  	client := createClient()
    12  
    13  	clients, err := client.Clients().ListAll()
    14  	if err != nil {
    15  		t.Fatalf("Clients.ListAll returned error: %v", err)
    16  	}
    17  	if clients == nil {
    18  		t.Fatalf("Clients.ListAll returned nil")
    19  	}
    20  
    21  	for _, response := range clients {
    22  		if response.LastActiveSessionID == nil {
    23  			continue
    24  		}
    25  		clientId := response.ID
    26  		clientResponse, err := client.Clients().Read(clientId)
    27  		if err != nil {
    28  			t.Fatalf("Clients.Read returned error: %v", err)
    29  		}
    30  		if clientResponse == nil {
    31  			t.Fatalf("Clients.Read returned nil")
    32  		}
    33  	}
    34  }