@@ -16,11 +16,8 @@ package modules
1616
1717import (
1818 "context"
19- "encoding/json"
2019 "github.com/stretchr/testify/mock"
21- "io/ioutil"
2220 "math/big"
23- "path"
2421
2522 //"encoding/json"
2623 "errors"
@@ -1218,6 +1215,117 @@ func TestBalance(t *testing.T) {
12181215// mockHandler.AssertExpectations(t)
12191216//}
12201217
1218+ //func TestBootstrapBalances(t *testing.T) {
1219+ // var (
1220+ // blockIdentifier = &types.BlockIdentifier{
1221+ // Hash: "block",
1222+ // Index: 1,
1223+ // }
1224+ //
1225+ // accountCoin = &types.AccountIdentifier{
1226+ // Address: "test",
1227+ // }
1228+ //
1229+ // currency = &types.Currency{
1230+ // Symbol: "BLAH",
1231+ // Decimals: 2,
1232+ // }
1233+ //
1234+ // amountCoins = &types.Amount{
1235+ // Value: "60",
1236+ // Currency: currency,
1237+ // }
1238+ //
1239+ // accountCoins = []*types.Coin{
1240+ // {
1241+ // CoinIdentifier: &types.CoinIdentifier{Identifier: "coin1"},
1242+ // Amount: &types.Amount{
1243+ // Value: "30",
1244+ // Currency: currency,
1245+ // },
1246+ // },
1247+ // {
1248+ // CoinIdentifier: &types.CoinIdentifier{Identifier: "coin2"},
1249+ // Amount: &types.Amount{
1250+ // Value: "30",
1251+ // Currency: currency,
1252+ // },
1253+ // },
1254+ // }
1255+ //
1256+ // accountBalance = &types.AccountIdentifier{
1257+ // Address: "test2",
1258+ // }
1259+ //
1260+ // amountBalance = &types.Amount{
1261+ // Value: "100",
1262+ // Currency: currency,
1263+ // }
1264+ //
1265+ // accBalance1 = &utils.AccountBalance{
1266+ // Account: accountCoin,
1267+ // Amount: amountCoins,
1268+ // Coins: accountCoins,
1269+ // Block: blockIdentifier,
1270+ // }
1271+ //
1272+ // accBalance2 = &utils.AccountBalance{
1273+ // Account: accountBalance,
1274+ // Amount: amountBalance,
1275+ // Block: blockIdentifier,
1276+ // }
1277+ // )
1278+ //
1279+ // ctx := context.Background()
1280+ //
1281+ // newDir, err := utils.CreateTempDir()
1282+ // assert.NoError(t, err)
1283+ // defer utils.RemoveTempDir(newDir)
1284+ //
1285+ // database, err := newTestBadgerDatabase(ctx, newDir)
1286+ // assert.NoError(t, err)
1287+ // defer database.Close(ctx)
1288+ //
1289+ // storage := NewBalanceStorage(database)
1290+ // mockHelper := &mocks.BalanceStorageHelper{}
1291+ // mockHandler := &mocks.BalanceStorageHandler{}
1292+ // mockHelper.On("Asserter").Return(baseAsserter())
1293+ // mockHelper.On("ExemptFunc").Return(exemptFunc())
1294+ // mockHelper.On("BalanceExemptions").Return([]*types.BalanceExemption{})
1295+ // storage.Initialize(mockHelper, mockHandler)
1296+ //
1297+ // t.Run("Set balance successfully", func(t *testing.T) {
1298+ // mockHandler.On("AccountsSeen", ctx, mock.Anything, 1).Return(nil).Twice()
1299+ // err = storage.SetBalanceImported(
1300+ // ctx,
1301+ // nil,
1302+ // []*utils.AccountBalance{accBalance1, accBalance2},
1303+ // )
1304+ // assert.NoError(t, err)
1305+ //
1306+ // amount1, err := storage.GetOrSetBalance(
1307+ // ctx,
1308+ // accountCoin,
1309+ // currency,
1310+ // blockIdentifier,
1311+ // )
1312+ // assert.NoError(t, err)
1313+ // assert.Equal(t, amount1.Value, amountCoins.Value)
1314+ //
1315+ // amount2, err := storage.GetOrSetBalance(
1316+ // ctx,
1317+ // accountBalance,
1318+ // currency,
1319+ // blockIdentifier,
1320+ // )
1321+ // assert.NoError(t, err)
1322+ // assert.Equal(t, amount2.Value, amountBalance.Value)
1323+ // })
1324+ //
1325+ // mockHelper.AssertExpectations(t)
1326+ // mockHandler.AssertExpectations(t)
1327+ //}
1328+ //
12211329//func TestBootstrapBalances(t *testing.T) {
12221330// var (
12231331// genesisBlockIdentifier = &types.BlockIdentifier{
@@ -1425,7 +1533,7 @@ func TestBalance(t *testing.T) {
14251533// mockHelper.AssertExpectations(t)
14261534// mockHandler.AssertExpectations(t)
14271535//}
1428-
1536+ //
14291537//func TestBalanceReconciliation(t *testing.T) {
14301538// var (
14311539// account = &types.AccountIdentifier{
0 commit comments