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

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/brianvoe/gofakeit/v6"
    10  	"github.com/clerkinc/clerk-sdk-go/clerk"
    11  	"github.com/stretchr/testify/assert"
    12  	"github.com/stretchr/testify/require"
    13  )
    14  
    15  func TestProxyChecks(t *testing.T) {
    16  	client := createClient()
    17  	// Create a domain first
    18  	domainName := gofakeit.DomainName()
    19  	domain, err := client.Domains().Create(clerk.CreateDomainParams{
    20  		Name:        domainName,
    21  		IsSatellite: true,
    22  	})
    23  	require.NoError(t, err)
    24  
    25  	// Now trigger a proxy check. Most likely a proxy is not configured.
    26  	_, err = client.ProxyChecks().Create(clerk.CreateProxyCheckParams{
    27  		DomainID: domain.ID,
    28  		ProxyURL: "https://" + domainName + "/__clerk",
    29  	})
    30  	assert.Error(t, err)
    31  }