From dfa9bc811734d8e1ff8a4863ec7c52a8a0ea5d22 Mon Sep 17 00:00:00 2001 From: zramsay Date: Mon, 19 Feb 2018 18:02:04 +0000 Subject: [PATCH] baseapp: start TestInfo (#471) --- baseapp/baseapp_test.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 8eac7ad102..0467233b92 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -48,22 +48,35 @@ func TestMountStores(t *testing.T) { err = app.LoadLatestVersion(capKey2) assert.Nil(t, err) } - +// Test that we can make commits and then reload old versions. +// Test that LoadLatestVersion actually does. func TestLoadVersion(t *testing.T) { // TODO - // Test that we can make commits and then reload old versions. - // Test that LoadLatestVersion actually does. } +// Test that txs can be unmarshalled and read and that +// correct error codes are returned when not func TestTxDecoder(t *testing.T) { // TODO - // Test that txs can be unmarshalled and read and that - // correct error codes are returned when not } +// Test that Info returns the latest committed state. func TestInfo(t *testing.T) { + + app := newBaseApp(t.Name()) + + // ----- test an empty response ------- + reqInfo := abci.RequestInfo{} + res := app.Info(reqInfo) + + // should be empty + assert.Equal(t, "", res.Version) + assert.Equal(t, int64(0), res.LastBlockHeight) + assert.Equal(t, []uint8(nil), res.LastBlockAppHash) + + // ----- test a proper response ------- // TODO - // Test that Info returns the latest committed state. + } func TestInitChainer(t *testing.T) { @@ -101,14 +114,14 @@ func TestInitChainer(t *testing.T) { assert.Equal(t, value, res.Value) } -// Test that successive CheckTx can see eachothers effects +// Test that successive CheckTx can see each others' effects // on the store within a block, and that the CheckTx state // gets reset to the latest Committed state during Commit func TestCheckTx(t *testing.T) { // TODO } -// Test that successive DeliverTx can see eachothers effects +// Test that successive DeliverTx can see each others' effects // on the store, both within and across blocks. func TestDeliverTx(t *testing.T) { app := newBaseApp(t.Name())