Skip to content

Commit

Permalink
nullable/ommitempty fixes for #182 (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 authored Mar 15, 2024
1 parent 97113cc commit bd8e345
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion carrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type CarrierServiceOp struct {
// CarrierService represents a Shopify carrier service
type CarrierService struct {
// Whether this carrier service is active.
Active bool `json:"active,omitempty"`
Active *bool `json:"active"`

// The URL endpoint that Shopify needs to retrieve shipping rates. This must be a public URL.
CallbackUrl string `json:"callback_url,omitempty"`
Expand Down
16 changes: 12 additions & 4 deletions carrier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ func TestCarrierList(t *testing.T) {
t.Errorf("Carrier.List returned error: %v", err)
}

trueVar := true

expected := []CarrierService{
{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -50,10 +52,12 @@ func TestCarrierGet(t *testing.T) {
t.Errorf("Carrier.Get returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -77,10 +81,12 @@ func TestCarrierCreate(t *testing.T) {
t.Errorf("Carrier.Create returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -104,10 +110,12 @@ func TestCarrierUpdate(t *testing.T) {
t.Errorf("Carrier.Update returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand Down

0 comments on commit bd8e345

Please sign in to comment.