Test PostTxsResponse

This commit is contained in:
Simon Warta 2020-03-11 13:19:17 +01:00
parent 72e7638c19
commit 9428bab50a
2 changed files with 13 additions and 5 deletions

View File

@ -18,10 +18,10 @@ import {
fromOneElementArray,
getHackatom,
makeRandomAddress,
nonNegativeIntegerMatcher,
pendingWithoutWasmd,
semverMatcher,
tendermintAddressMatcher,
tendermintHeightMatcher,
tendermintIdMatcher,
tendermintOptionalIdMatcher,
tendermintShortHashMatcher,
@ -178,7 +178,7 @@ describe("RestClient", () => {
pendingWithoutWasmd();
const client = new RestClient(wasmd.endpoint);
const { height, result } = await client.authAccounts(unusedAccount.address);
expect(height).toMatch(tendermintHeightMatcher);
expect(height).toMatch(nonNegativeIntegerMatcher);
expect(result).toEqual({
type: "cosmos-sdk/Account",
value: {
@ -649,8 +649,16 @@ describe("RestClient", () => {
const signature = await pen.sign(signBytes);
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
const result = await client.postTx(signedTx);
// console.log("Raw log:", result.raw_log);
expect(result.code).toBeFalsy();
expect(result.code).toBeUndefined();
expect(result).toEqual({
height: jasmine.stringMatching(nonNegativeIntegerMatcher),
txhash: jasmine.stringMatching(tendermintIdMatcher),
// code is not set
raw_log: jasmine.stringMatching(/^\[.+\]$/i),
logs: jasmine.any(Array),
gas_wanted: jasmine.stringMatching(nonNegativeIntegerMatcher),
gas_used: jasmine.stringMatching(nonNegativeIntegerMatcher),
});
});
it("can upload, instantiate and execute wasm", async () => {

View File

@ -11,7 +11,7 @@ export function makeRandomAddress(): string {
return Bech32.encode("cosmos", Random.getBytes(20));
}
export const tendermintHeightMatcher = /^[0-9]+$/;
export const nonNegativeIntegerMatcher = /^[0-9]+$/;
export const tendermintIdMatcher = /^[0-9A-F]{64}$/;
export const tendermintOptionalIdMatcher = /^([0-9A-F]{64}|)$/;
export const tendermintAddressMatcher = /^[0-9A-F]{40}$/;