Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go kosu/rpc docs #176

Merged
merged 15 commits into from Aug 1, 2019

go-kosu: add godocs

  • Loading branch information
gchaincl committed Jul 31, 2019
commit af173e889cb94069444e80c4114383d490dd81ea
@@ -10,18 +10,20 @@ import (
"text/template"
)

// nolint
// DocEntry holds documentation for a method
type DocEntry struct {
Method string `json:"method"`
Text string `json:"text"`
}

// TypeDocs holds the documentation of a given type
type TypeDocs struct {
Title string
Description string
Entries []DocEntry
}

// PkgDocs is the top level doc struct
type PkgDocs struct {
Title string
Description string
@@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/require"

"go-kosu/abci"
"go-kosu/abci/types"
"go-kosu/tests"

"github.com/tendermint/tendermint/libs/db"
@@ -62,31 +61,3 @@ func TestRPCLatestHeight(t *testing.T) {
}
}
}

func TestQueryPoster(t *testing.T) {
app, client, closer := setupNewTestClient(t)
defer closer()

poster := &types.Poster{
Limit: 99,
}
app.Store().SetPoster("abc", *poster)
app.Store().Commit()

t.Run("Found", func(t *testing.T) {
var res types.Poster
require.NoError(t,
client.Call(&res, "kosu_queryPoster", "abc"),
)
assert.Equal(t, *poster, res)

})

t.Run("NotFound", func(t *testing.T) {
var res types.Poster
err := client.Call(&res, "kosu_queryPoster", "a-not-found-address")
require.NotNil(t, err)
assert.Error(t, err)
assert.Contains(t, err.Error(), "not found")
})
}
@@ -109,6 +109,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"kosu_latestHeight", "id": 1}' lo
{"jsonrpc":"2.0","id":1,"result":260}
```
*/
// nolint:lll
func (s *Service) LatestHeight() (int64, error) {
res, err := s.abci.Block(nil)
if err != nil {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.