|
1 | 1 | package core_test
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "github.com/OpenBazaar/openbazaar-go/test/factory" |
5 |
| - "github.com/go-errors/errors" |
6 |
| - "testing" |
7 |
| - |
8 | 4 | "github.com/OpenBazaar/openbazaar-go/core"
|
9 | 5 | "github.com/OpenBazaar/openbazaar-go/pb"
|
10 | 6 | "github.com/OpenBazaar/openbazaar-go/test"
|
| 7 | + "github.com/OpenBazaar/openbazaar-go/test/factory" |
11 | 8 | "github.com/golang/protobuf/proto"
|
| 9 | + |
| 10 | + "fmt" |
| 11 | + "testing" |
12 | 12 | )
|
13 | 13 |
|
14 | 14 | func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
|
@@ -362,30 +362,30 @@ func TestOpenBazaarNode_CalculateOrderTotal(t *testing.T) {
|
362 | 362 | func TestOpenBazaarNode_GetOrder(t *testing.T) {
|
363 | 363 | node, err := test.NewNode()
|
364 | 364 | if err != nil {
|
365 |
| - t.Error(err) |
| 365 | + t.Fatal(err) |
366 | 366 | }
|
367 | 367 |
|
368 | 368 | contract := factory.NewContract()
|
| 369 | + |
369 | 370 | orderID, err := node.CalcOrderID(contract.BuyerOrder)
|
370 | 371 | if err != nil {
|
371 |
| - t.Error(err) |
| 372 | + t.Fatal(err) |
372 | 373 | }
|
373 | 374 |
|
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) |
375 | 377 | if err != nil {
|
376 |
| - t.Error(err) |
| 378 | + t.Fatal(err) |
377 | 379 | }
|
378 | 380 |
|
379 | 381 | orderResponse, err := node.GetOrder(orderID)
|
380 | 382 | 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) |
386 | 384 | }
|
387 | 385 |
|
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)])) |
390 | 390 | }
|
391 | 391 | }
|
0 commit comments