@@ -61,7 +61,7 @@ func TestSubscriptionInvoicesService_List(t *testing.T) {
6161 client := New (WithBaseURL (server .URL ))
6262
6363 // Act
64- invoices , response , err := client .SubscriptionInvoices .List (context .Background ())
64+ invoices , response , err := client .SubscriptionInvoices .List (context .Background (), nil )
6565
6666 // Assert
6767 assert .Nil (t , err )
@@ -83,7 +83,7 @@ func TestSubscriptionInvoicesService_ListWithError(t *testing.T) {
8383 client := New (WithBaseURL (server .URL ))
8484
8585 // Act
86- _ , response , err := client .SubscriptionInvoices .List (context .Background ())
86+ _ , response , err := client .SubscriptionInvoices .List (context .Background (), nil )
8787
8888 // Assert
8989 assert .NotNil (t , err )
@@ -99,18 +99,30 @@ func TestSubscriptionInvoicesService_Generate(t *testing.T) {
9999 t .Parallel ()
100100
101101 // Arrange
102- server := helpers .MakeTestServer (http .StatusOK , stubs .SubscriptionInvoicesListResponse ())
102+ server := helpers .MakeTestServer (http .StatusOK , stubs .SubscriptionInvoicesGenerateResponse ())
103103 client := New (WithBaseURL (server .URL ))
104104
105105 // Act
106- invoices , response , err := client .SubscriptionInvoices .List (context .Background ())
106+ invoice , response , err := client .SubscriptionInvoices .Generate (context .Background (), "1234" , map [string ]string {
107+ "address" : "123 Main St" ,
108+ "city" : "Anytown" ,
109+ "country" : "US" ,
110+ "name" : "John Doe" ,
111+ "notes" : "Thank you for your business" ,
112+ "state" : "CA" ,
113+ "zip_code" : "12345" ,
114+ })
107115
108116 // Assert
109117 assert .Nil (t , err )
110118
111119 assert .Equal (t , http .StatusOK , response .HTTPResponse .StatusCode )
112- assert .Equal (t , stubs .SubscriptionInvoicesListResponse (), * response .Body )
113- assert .Equal (t , 1 , len (invoices .Data ))
120+ assert .Equal (t , stubs .SubscriptionInvoicesGenerateResponse (), * response .Body )
121+ assert .Equal (
122+ t ,
123+ "https://app.lemonsqueezy.com/my-orders/c1e4de31-b4cf-4668-a6fe-019d071d41ab/invoice/download?address=123%20Main%20St&city=Anytown&country=US&name=John%20Doe¬es=Thank%20you%20for%20your%20business&state=CA&zip_code=12345&signature=c21a17a13d9deeacc99ff52144a06b49df141af37dd668cc70a76bcc8022888e" ,
124+ invoice .Meta .Urls .DownloadInvoice ,
125+ )
114126
115127 // Teardown
116128 server .Close ()
0 commit comments