From b52add190a1665bcc42a6ec6e4b915494e8729b7 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 13 Apr 2021 18:15:15 +0200 Subject: [PATCH] cosmwasm-stargate: Update tests for stargate changes --- .../src/queries/wasm.spec.ts | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/packages/cosmwasm-stargate/src/queries/wasm.spec.ts b/packages/cosmwasm-stargate/src/queries/wasm.spec.ts index de961f4a1e..24f9ca2384 100644 --- a/packages/cosmwasm-stargate/src/queries/wasm.spec.ts +++ b/packages/cosmwasm-stargate/src/queries/wasm.spec.ts @@ -15,14 +15,7 @@ import { import { assert, assertDefined } from "@cosmjs/utils"; import Long from "long"; -import { - MsgExecuteContract, - MsgExecuteContractResponse, - MsgInstantiateContract, - MsgInstantiateContractResponse, - MsgStoreCode, - MsgStoreCodeResponse, -} from "../codec/x/wasm/internal/types/tx"; +import { MsgExecuteContract, MsgInstantiateContract, MsgStoreCode } from "../codec/x/wasm/internal/types/tx"; import { ContractCodeHistoryOperationType } from "../codec/x/wasm/internal/types/types"; import { SigningCosmWasmClient } from "../signingcosmwasmclient"; import { @@ -30,7 +23,6 @@ import { base64Matcher, bech32AddressMatcher, ContractUploadInstructions, - fromOneElementArray, getHackatom, makeRandomAddress, makeWasmClient, @@ -393,13 +385,8 @@ describe("WasmExtension", () => { codeId = Number.parseInt(codeIdAttr.value, 10); expect(codeId).toBeGreaterThanOrEqual(1); expect(codeId).toBeLessThanOrEqual(200); - - assertDefined(result.data); - const msgData = fromOneElementArray(result.data); - expect(msgData.msgType).toEqual("store-code"); - expect(MsgStoreCodeResponse.decode(msgData.data)).toEqual( - MsgStoreCodeResponse.fromPartial({ codeId: Long.fromNumber(codeId, true) }), - ); + const actionAttr = logs.findAttribute(parsedLogs, "message", "action"); + expect(actionAttr.value).toEqual("store-code"); } let contractAddress: string; @@ -413,12 +400,8 @@ describe("WasmExtension", () => { contractAddress = contractAddressAttr.value; const amountAttr = logs.findAttribute(parsedLogs, "transfer", "amount"); expect(amountAttr.value).toEqual("1234ucosm,321ustake"); - - assertDefined(result.data); - const msgData = fromOneElementArray(result.data); - expect(msgData.msgType).toEqual("instantiate"); - const response = MsgInstantiateContractResponse.decode(msgData.data); - expect(response).toEqual(MsgInstantiateContractResponse.fromPartial({ address: contractAddress })); + const actionAttr = logs.findAttribute(parsedLogs, "message", "action"); + expect(actionAttr.value).toEqual("instantiate"); const balanceUcosm = await client.bank.balance(contractAddress, "ucosm"); expect(balanceUcosm).toEqual(transferAmount[0]); @@ -439,13 +422,6 @@ describe("WasmExtension", () => { value: beneficiaryAddress, }); - assertDefined(result.data); - const msgData = fromOneElementArray(result.data); - expect(msgData.msgType).toEqual("execute"); - expect(MsgExecuteContractResponse.decode(msgData.data)).toEqual( - MsgExecuteContractResponse.fromPartial({ data: fromHex("F00BAA") }), - ); - // Verify token transfer from contract to beneficiary const beneficiaryBalanceUcosm = await client.bank.balance(beneficiaryAddress, "ucosm"); expect(beneficiaryBalanceUcosm).toEqual(transferAmount[0]);