Skip to content

Commit

Permalink
Updated Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsidhu1313 committed Jul 23, 2024
1 parent 9d72d56 commit 5d823bb
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions customer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,26 +353,24 @@ func TestCustomerGet(t *testing.T) {
}

expectation := &Customer{
Id: 1,
Email: "[email protected]",
FirstName: "Test",
LastName: "Citizen",
AcceptsMarketing: true,
VerifiedEmail: true,
TaxExempt: false,
OrdersCount: 4,
State: "enabled",
TotalSpent: &totalSpent,
LastOrderId: 123,
Note: "",
Phone: "",
AcceptsMarketingUpdatedAt: &updatedAt,
EmailMarketingConsent: &emailMarketingConsent1,
SMSMarketingConsent: &smsMarketingConsent1,
DefaultAddress: address1,
Addresses: []*CustomerAddress{address1},
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
Id: 1,
Email: "[email protected]",
FirstName: "Test",
LastName: "Citizen",
VerifiedEmail: true,
TaxExempt: false,
OrdersCount: 4,
State: "enabled",
TotalSpent: &totalSpent,
LastOrderId: 123,
Note: "",
Phone: "",
EmailMarketingConsent: &emailMarketingConsent1,
SMSMarketingConsent: &smsMarketingConsent1,
DefaultAddress: address1,
Addresses: []*CustomerAddress{address1},
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
}

if customer.Id != expectation.Id {
Expand All @@ -387,9 +385,6 @@ func TestCustomerGet(t *testing.T) {
if customer.LastName != expectation.LastName {
t.Errorf("Customer.LastName returned %+v, expected %+v", customer.LastName, expectation.LastName)
}
if customer.AcceptsMarketing != expectation.AcceptsMarketing {
t.Errorf("Customer.AcceptsMarketing returned %+v, expected %+v", customer.AcceptsMarketing, expectation.AcceptsMarketing)
}
if !customer.CreatedAt.Equal(*expectation.CreatedAt) {
t.Errorf("Customer.CreatedAt returned %+v, expected %+v", customer.CreatedAt, expectation.CreatedAt)
}
Expand Down Expand Up @@ -481,9 +476,6 @@ func TestCustomerGet(t *testing.T) {
if len(customer.Addresses) != len(expectation.Addresses) {
t.Errorf("Customer.Addresses count returned %d, expected %d", len(customer.Addresses), len(expectation.Addresses))
}
if !customer.AcceptsMarketingUpdatedAt.Equal(*expectation.AcceptsMarketingUpdatedAt) {
t.Errorf("Customer.AcceptsMarketingUpdatedAt returned %+v, expected %+v", customer.AcceptsMarketingUpdatedAt, expectation.AcceptsMarketingUpdatedAt)
}
if customer.EmailMarketingConsent == nil {
t.Errorf("Customer.EmailMarketingConsent is nil, expected not nil")
} else {
Expand Down

0 comments on commit 5d823bb

Please sign in to comment.