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

Commit 1c34213

Browse files
committed
Fix unit tests
1 parent f9d8d62 commit 1c34213

6 files changed

+27
-15
lines changed

repo/migrations/Migration012_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ var testMigraion012_listingFixtures = []pb.SignedListing{
605605
}
606606

607607
var testMigraion012_listingFixtureHashes = map[string]string{
608-
"slug-4": "QmXC26R4PNnArmVssrviaA4WGxP1zzmx8y2AiybF6hQpRM",
609-
"slug-5": "QmaEUP6zWvZkrWAbVAvcxRiV5Fou8jQnHc4nmarAUVLoQr",
608+
"slug-4": "QmNtQxfK8MwkBCGMFhpxing7Q8hzRfcRWYpPabbEWMx5AQ",
609+
"slug-5": "QmboxBcYU6J7DGTkqVKtKqmCHhbJgGtan8vvputdWZfKRa",
610610
}
611611

612612
var testMigration012_configFixture = `{

repo/migrations/Migration027_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestUpdateListingHash(t *testing.T) {
3737
// This listing hash is generated using the default IPFS hashing algorithm as of v0.4.19
3838
// If the default hashing algorithm changes at any point in the future you can expect this
3939
// test to fail and it will need to be updated to maintain the functionality of this migration.
40-
expectedListingHash = "Qmdv3oZmVtRuN4tWewsUcBqFYKGD8kaQCq46Yx6rwzEDvH"
40+
expectedListingHash = "QmQa7GzhppHPEALQAko6UC1dZ7UggFq6eaNe1yyKU43vbW"
4141

4242
listing = factory.NewListing(testListingSlug)
4343
m = jsonpb.Marshaler{

repo/migrations/Migration028_test.go

+18-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ package migrations_test
33
import (
44
"encoding/base64"
55
"encoding/json"
6+
crypto "gx/ipfs/QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK/go-libp2p-crypto"
7+
"io/ioutil"
8+
"os"
9+
"strconv"
10+
"testing"
11+
612
"github.com/OpenBazaar/jsonpb"
713
"github.com/OpenBazaar/openbazaar-go/ipfs"
814
"github.com/OpenBazaar/openbazaar-go/pb"
@@ -11,11 +17,6 @@ import (
1117
"github.com/OpenBazaar/openbazaar-go/test/factory"
1218
"github.com/golang/protobuf/proto"
1319
coremock "github.com/ipfs/go-ipfs/core/mock"
14-
crypto "gx/ipfs/QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK/go-libp2p-crypto"
15-
"io/ioutil"
16-
"os"
17-
"strconv"
18-
"testing"
1920
)
2021

2122
const (
@@ -31,7 +32,8 @@ var (
3132
"contractType": "PHYSICAL_GOOD",
3233
"format": "FIXED_PRICE",
3334
"pricingCurrency": "BTC",
34-
"priceModifier": 1
35+
"priceModifier": 1,
36+
"shippingFromCountryCode": "NA"
3537
},
3638
"item": {
3739
"price": 100,
@@ -71,7 +73,8 @@ var (
7173
"format": "MARKET_PRICE",
7274
"coinType": "BAT",
7375
"coinDivisibility": 8,
74-
"priceModifier": 50
76+
"priceModifier": 50,
77+
"shippingFromCountryCode": "NA"
7578
},
7679
"item": {
7780
"skus": [
@@ -90,7 +93,8 @@ var (
9093
"metadata": {
9194
"version": 5,
9295
"contractType": "PHYSICAL_GOOD",
93-
"format": "FIXED_PRICE"
96+
"format": "FIXED_PRICE",
97+
"shippingFromCountryCode": "NA"
9498
},
9599
"item": {
96100
"skus": [
@@ -134,7 +138,8 @@ var (
134138
"contractType": "CRYPTOCURRENCY",
135139
"format": "MARKET_PRICE",
136140
"coinType": "BAT",
137-
"coinDivisibility": 8
141+
"coinDivisibility": 8,
142+
"shippingFromCountryCode": "NA"
138143
},
139144
"item": {
140145
"skus": [
@@ -240,10 +245,14 @@ func TestMigrateListingsToV5Schema(t *testing.T) {
240245
}
241246

242247
if string(upMigratedListing) != postMigrateListingsToV5Schema_ListingJSON {
248+
t.Log(string(upMigratedListing))
249+
t.Log(postMigrateListingsToV5Schema_ListingJSON)
243250
t.Error("Failed to migrate listing up")
244251
}
245252

246253
if string(upMigratedCryptoListing) != postMigrateListingsToV5Schema_CryptoListingJSON {
254+
t.Log(string(upMigratedCryptoListing))
255+
t.Log(postMigrateListingsToV5Schema_CryptoListingJSON)
247256
t.Error("Failed to migrate crypto listing up")
248257
}
249258

test/factory/fixtures/listings/v5-physical-good.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"LTC",
2222
"ETH"
2323
],
24-
"escrowTimeoutHours": 1
24+
"escrowTimeoutHours": 1,
25+
"shippingFromCountryCode": "NA"
2526
},
2627
"item": {
2728
"title": "ETH - $1",

test/factory/fixtures/listings/v5-signed-physical-good-2.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"BTC",
2121
"BCH"
2222
],
23-
"escrowTimeoutHours": 1080
23+
"escrowTimeoutHours": 1080,
24+
"shippingFromCountryCode": "NA"
2425
},
2526
"item": {
2627
"title": "EXAMPLE FILE 1",

test/factory/fixtures/listings/v5-signed-physical-good.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"divisibility": 2,
2727
"currencyType": "fiat"
2828
},
29-
"escrowTimeoutHours": 1
29+
"escrowTimeoutHours": 1,
30+
"shippingFromCountryCode": "NA"
3031
},
3132
"item": {
3233
"title": "ETH - $1",

0 commit comments

Comments
 (0)