forked from getconversio/go-shopify
-
Notifications
You must be signed in to change notification settings - Fork 254
/
abandoned_checkout_test.go
34 lines (28 loc) · 762 Bytes
/
abandoned_checkout_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package goshopify
import (
"context"
"fmt"
"reflect"
"testing"
"github.com/jarcoal/httpmock"
)
func TestAbandonedCheckoutList(t *testing.T) {
setup()
defer teardown()
httpmock.RegisterResponder(
"GET",
fmt.Sprintf("https://fooshop.myshopify.com/%s/checkouts.json", client.pathPrefix),
httpmock.NewStringResponder(
200,
`{"checkouts": [{"id":1},{"id":2}]}`,
),
)
abandonedCheckouts, err := client.AbandonedCheckout.List(context.Background(), nil)
if err != nil {
t.Errorf("AbandonedCheckout.List returned error: %v", err)
}
expected := []AbandonedCheckout{{Id: 1}, {Id: 2}}
if !reflect.DeepEqual(abandonedCheckouts, expected) {
t.Errorf("AbandonedCheckout.List returned %+v, expected %+v", abandonedCheckouts, expected)
}
}