github.com/stripe/stripe-go/v76@v76.25.0/taxid/client_test.go (about)

     1  package taxid
     2  
     3  import (
     4  	"testing"
     5  
     6  	assert "github.com/stretchr/testify/require"
     7  	stripe "github.com/stripe/stripe-go/v76"
     8  	_ "github.com/stripe/stripe-go/v76/testing"
     9  )
    10  
    11  func TestTaxIDDel(t *testing.T) {
    12  	taxid, err := Del("txi_123", &stripe.TaxIDParams{
    13  		Customer: stripe.String("cus_123"),
    14  	})
    15  	assert.Nil(t, err)
    16  	assert.NotNil(t, taxid)
    17  }
    18  
    19  func TestTaxIDGet(t *testing.T) {
    20  	taxid, err := Get("txi_123", &stripe.TaxIDParams{
    21  		Customer: stripe.String(string(stripe.TaxIDTypeAUABN)),
    22  	})
    23  	assert.Nil(t, err)
    24  	assert.NotNil(t, taxid)
    25  }
    26  
    27  func TestTaxIDList(t *testing.T) {
    28  	i := List(&stripe.TaxIDListParams{
    29  		Customer: stripe.String("cus_123"),
    30  	})
    31  
    32  	// Verify that we can get at least one taxid
    33  	assert.True(t, i.Next())
    34  	assert.Nil(t, i.Err())
    35  	assert.NotNil(t, i.TaxID())
    36  	assert.NotNil(t, i.TaxIDList())
    37  }
    38  
    39  func TestTaxIDNew(t *testing.T) {
    40  	taxid, err := New(&stripe.TaxIDParams{
    41  		Customer: stripe.String("cus_123"),
    42  		Type:     stripe.String(string(stripe.TaxIDTypeEUVAT)),
    43  		Value:    stripe.String("11111"),
    44  	})
    45  	assert.Nil(t, err)
    46  	assert.NotNil(t, taxid)
    47  }