Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 3cd2780

Browse files
committed
Address review notes
1 parent db9e295 commit 3cd2780

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

core/order_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package core_test
22

33
import (
4-
"github.com/OpenBazaar/openbazaar-go/test/factory"
5-
"github.com/go-errors/errors"
6-
"testing"
7-
84
"github.com/OpenBazaar/openbazaar-go/core"
95
"github.com/OpenBazaar/openbazaar-go/pb"
106
"github.com/OpenBazaar/openbazaar-go/test"
7+
"github.com/OpenBazaar/openbazaar-go/test/factory"
118
"github.com/golang/protobuf/proto"
9+
10+
"fmt"
11+
"testing"
1212
)
1313

1414
func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
@@ -362,30 +362,30 @@ func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
362362
func TestOpenBazaarNode_GetOrder(t *testing.T) {
363363
node, err := test.NewNode()
364364
if err != nil {
365-
t.Error(err)
365+
t.Fatal(err)
366366
}
367367

368368
contract := factory.NewContract()
369+
369370
orderID, err := node.CalcOrderID(contract.BuyerOrder)
370371
if err != nil {
371-
t.Error(err)
372+
t.Fatal(err)
372373
}
373374

374-
err = node.Datastore.Purchases().Put(orderID, *contract, pb.OrderState_AWAITING_PAYMENT, false)
375+
state := pb.OrderState_AWAITING_PAYMENT
376+
err = node.Datastore.Purchases().Put(orderID, *contract, state, false)
375377
if err != nil {
376-
t.Error(err)
378+
t.Fatal(err)
377379
}
378380

379381
orderResponse, err := node.GetOrder(orderID)
380382
if err != nil {
381-
t.Error(err)
382-
}
383-
384-
if orderResponse.Funded {
385-
t.Error(errors.New("Should not be funded"))
383+
t.Fatal(err)
386384
}
387385

388-
if orderResponse.State != pb.OrderState_AWAITING_PAYMENT {
389-
t.Error(errors.New("Expected state OrderState_AWAITING_PAYMENT"))
386+
if orderResponse.State != state {
387+
t.Fatal(fmt.Errorf("expected attribute description to be %s, but was %s",
388+
pb.OrderState_name[int32(state)],
389+
pb.OrderState_name[int32(orderResponse.State)]))
390390
}
391391
}

0 commit comments

Comments
 (0)