示例#1
0
func TestHandleFactoidBalance(t *testing.T) {
	context := testHelper.CreateWebContext()
	eckey := testHelper.NewFactoidRCDAddressString(0)

	//t.Logf("%v\n", eckey)

	HandleFactoidBalance(context, eckey)

	//expectedAmount := fmt.Sprintf("%v", uint64(testHelper.BlockCount)*testHelper.DefaultCoinbaseAmount)
	expectedAmount := "999889000"
	if strings.Contains(testHelper.GetBody(context), expectedAmount) == false {
		t.Errorf("%v", testHelper.GetBody(context))
	}
}
示例#2
0
func TestV2HandleFactoidBalance(t *testing.T) {
	state := testHelper.CreateAndPopulateTestState()
	eckey := testHelper.NewFactoidRCDAddressString(0)
	req := new(AddressRequest)
	req.Address = eckey

	resp, err := HandleV2FactoidBalance(state, req)
	if err != nil {
		t.Errorf("%v", err)
	}

	var expectedAmount int64 = 999889000

	if resp.(*FactoidBalanceResponse).Balance != expectedAmount {
		t.Errorf("Invalid balance returned - %v vs %v", resp.(*FactoidBalanceResponse).Balance, expectedAmount)
	}
}