mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/storage/mock/explorer: add more comments to testHandler function
This commit is contained in:
parent
7a9dc5a237
commit
24563b57b8
1 changed files with 7 additions and 0 deletions
|
|
@ -173,6 +173,7 @@ func testHandler(t *testing.T, globalStore mock.GlobalStorer) {
|
||||||
|
|
||||||
handler := NewHandler(globalStore, nil)
|
handler := NewHandler(globalStore, nil)
|
||||||
|
|
||||||
|
// this subtest confirms that it has uploaded key and that it does not have invalid keys
|
||||||
t.Run("has key", func(t *testing.T) {
|
t.Run("has key", func(t *testing.T) {
|
||||||
for addr, keys := range nodeKeys {
|
for addr, keys := range nodeKeys {
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
|
|
@ -185,6 +186,7 @@ func testHandler(t *testing.T, globalStore mock.GlobalStorer) {
|
||||||
testStatusResponse(t, handler, "/api/has-key/"+unmatchedAddr+"/"+unmatchedKey, http.StatusNotFound)
|
testStatusResponse(t, handler, "/api/has-key/"+unmatchedAddr+"/"+unmatchedKey, http.StatusNotFound)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// this subtest confirms that all keys are are listed in correct order with expected pagination
|
||||||
t.Run("keys", func(t *testing.T) {
|
t.Run("keys", func(t *testing.T) {
|
||||||
var allKeys []string
|
var allKeys []string
|
||||||
for key := range keyNodes {
|
for key := range keyNodes {
|
||||||
|
|
@ -201,6 +203,8 @@ func testHandler(t *testing.T, globalStore mock.GlobalStorer) {
|
||||||
t.Run("limit negative", testKeys(handler, allKeys, -10, ""))
|
t.Run("limit negative", testKeys(handler, allKeys, -10, ""))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// this subtest confirms that all keys are are listed for every node in correct order
|
||||||
|
// and that for one node different pagination options are correct
|
||||||
t.Run("node keys", func(t *testing.T) {
|
t.Run("node keys", func(t *testing.T) {
|
||||||
var limitCheckAddr string
|
var limitCheckAddr string
|
||||||
|
|
||||||
|
|
@ -222,6 +226,7 @@ func testHandler(t *testing.T, globalStore mock.GlobalStorer) {
|
||||||
t.Run("limit negative", testKeys(handler, limitCheckKeys, -10, limitCheckAddr))
|
t.Run("limit negative", testKeys(handler, limitCheckKeys, -10, limitCheckAddr))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// this subtest confirms that all nodes are are listed in correct order with expected pagination
|
||||||
t.Run("nodes", func(t *testing.T) {
|
t.Run("nodes", func(t *testing.T) {
|
||||||
var allNodes []string
|
var allNodes []string
|
||||||
for addr := range nodeKeys {
|
for addr := range nodeKeys {
|
||||||
|
|
@ -238,6 +243,8 @@ func testHandler(t *testing.T, globalStore mock.GlobalStorer) {
|
||||||
t.Run("limit negative", testNodes(handler, allNodes, -10, ""))
|
t.Run("limit negative", testNodes(handler, allNodes, -10, ""))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// this subtest confirms that all nodes are are listed that contain a a particular key in correct order
|
||||||
|
// and that for one key different node pagination options are correct
|
||||||
t.Run("key nodes", func(t *testing.T) {
|
t.Run("key nodes", func(t *testing.T) {
|
||||||
var limitCheckKey string
|
var limitCheckKey string
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue