Re-enable test cases

This commit is contained in:
Ethan Frey 2020-02-03 22:53:05 +01:00
parent 1fbfa311c3
commit f52bb378b4
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import { PostableBytes, PrehashType } from "@iov/bcp";
import { Encoding } from "@iov/encoding";
import { cosmWasmCodec } from "./cosmwasmcodec";
import { chainId, nonce, sendTxJson, signedTxBin, signedTxJson } from "./testdata.spec";
import { chainId, nonce, sendTxJson, signedTxBin, signedTxEncodedJson, signedTxJson } from "./testdata.spec";
const { toUtf8 } = Encoding;
@ -19,9 +19,9 @@ describe("cosmWasmCodec", () => {
expect(bytesToSign).toEqual(expected);
});
xit("properly encodes transactions", () => {
it("properly encodes transactions", () => {
const encoded = cosmWasmCodec.bytesToPost(signedTxJson);
expect(encoded).toEqual(signedTxBin);
expect(encoded).toEqual(signedTxEncodedJson);
});
it("throws when trying to decode a transaction without a nonce", () => {
@ -30,8 +30,8 @@ describe("cosmWasmCodec", () => {
);
});
xit("properly decodes transactions", () => {
const decoded = cosmWasmCodec.parseBytes(signedTxBin as PostableBytes, chainId, nonce);
it("properly decodes transactions", () => {
const decoded = cosmWasmCodec.parseBytes(signedTxEncodedJson as PostableBytes, chainId, nonce);
expect(decoded).toEqual(signedTxJson);
});

View File

@ -16,7 +16,7 @@ import { Encoding } from "@iov/encoding";
import data from "./testdata/cosmoshub.json";
const { fromBase64 } = Encoding;
const { fromBase64, toUtf8 } = Encoding;
export const pubJson: PubkeyBundle = {
algo: Algorithm.Secp256k1,
@ -62,3 +62,7 @@ export const signedTxJson: SignedTransaction = {
export const signedTxBin = fromBase64(data.tx_data);
export const txId = data.id as TransactionId;
export const signedTxEncodedJson = toUtf8(
`{"msg":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"cosmos1txqfn5jmcts0x0q7krdxj8tgf98tj0965vqlmq","to_address":"cosmos1nynns8ex9fq6sjjfj8k79ymkdz4sqth06xexae","amount":[{"denom":"uatom","amount":"35997500"}]}}],"memo":"","signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A5qFcJBJvEK/fOmEAY0DHNWwSRZ9TEfNZyH8VoVvDtAq"},"signature":"NK1Oy4EUGAsoC03c1wi9GG03JC/39LEdautC5Jk643oIbEPqeXHMwaqbdvO/Jws0X/NAXaN8SAy2KNY5Qml+5Q=="}],"fee":{"amount":[{"denom":"uatom","amount":"2500"}],"gas":"100000"}}`,
);