Skip to content

Commit

Permalink
test: add pagination next key test in ContractHistory (CosmWasm#72)
Browse files Browse the repository at this point in the history
* test: add next pagination key test in ContractHistory

Signed-off-by: 170210 <j170210@icloud.com>

* chore: add this PR to CHANGELOG

Signed-off-by: 170210 <j170210@icloud.com>

* fixup: fix for comment

Signed-off-by: 170210 <j170210@icloud.com>

* fixup: set expPaginationTotal

Signed-off-by: 170210 <j170210@icloud.com>

---------

Signed-off-by: 170210 <j170210@icloud.com>
  • Loading branch information
170210 authored Aug 17, 2023
1 parent 7a49995 commit 07aec27
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [\#64](https://github.com/Finschia/wasmd/pull/64) test: add test cases to confirm output for PinnedCodes
* [\#70](https://github.com/Finschia/wasmd/pull/70) add event checking to TestInstantiateContract
* [\#73](https://github.com/Finschia/wasmd/pull/73) test: add the check for expPaginationTotal
* [\#72](https://github.com/Finschia/wasmd/pull/72) add pagination next key test in ContractHistory

### Bug Fixes
* [\#62](https://github.com/Finschia/wasmd/pull/62) fill ContractHistory querier result's Updated field
Expand Down
26 changes: 26 additions & 0 deletions x/wasm/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,32 @@ func TestQueryContractHistory(t *testing.T) {
}},
expPaginationTotal: 0,
},
"with pagination next key": {
srcHistory: []types.ContractCodeHistoryEntry{{
Operation: types.ContractCodeHistoryOperationTypeInit,
CodeID: firstCodeID,
Updated: &types.AbsoluteTxPosition{BlockHeight: 1, TxIndex: 2},
Msg: []byte(`"init message"`),
}, {
Operation: types.ContractCodeHistoryOperationTypeMigrate,
CodeID: 2,
Updated: &types.AbsoluteTxPosition{BlockHeight: 3, TxIndex: 4},
Msg: []byte(`"migrate message 1"`),
}},
req: &types.QueryContractHistoryRequest{
Address: myContractBech32Addr,
Pagination: &query.PageRequest{
Key: fromBase64("AAAAAAAAAAI="),
},
},
expContent: []types.ContractCodeHistoryEntry{{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
CodeID: 2,
Updated: &types.AbsoluteTxPosition{BlockHeight: 3, TxIndex: 4},
Msg: []byte(`"migrate message 1"`),
}},
expPaginationTotal: 0,
},
"unknown contract address": {
req: &types.QueryContractHistoryRequest{Address: otherBech32Addr},
srcHistory: []types.ContractCodeHistoryEntry{{
Expand Down

0 comments on commit 07aec27

Please sign in to comment.