feat(timeout-height): expectAsync fail test

This commit is contained in:
janfabian 2023-10-26 15:54:42 +02:00
parent 5bdd1215f5
commit af78d546ec
2 changed files with 32 additions and 36 deletions

View File

@ -1247,16 +1247,15 @@ describe("SigningCosmWasmClient", () => {
const height = await client.getHeight(); const height = await client.getHeight();
const signed = await client.sign(alice.address0, [msgAny], fee, memo, undefined, BigInt(height - 1)); const signed = await client.sign(alice.address0, [msgAny], fee, memo, undefined, BigInt(height - 1));
try { await expectAsync(
await client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())); client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())),
} catch (e: any) { ).toBeRejectedWith(
assert(e.code === 30); jasmine.objectContaining({
return; code: 30,
} finally { }),
client.disconnect(); );
}
throw new Error("tx should have failed because of past timeoutHeight"); client.disconnect();
}); });
}); });
@ -1530,16 +1529,15 @@ describe("SigningCosmWasmClient", () => {
const height = await client.getHeight(); const height = await client.getHeight();
const signed = await client.sign(alice.address0, [msgAny], fee, memo, undefined, BigInt(height - 1)); const signed = await client.sign(alice.address0, [msgAny], fee, memo, undefined, BigInt(height - 1));
try { await expectAsync(
await client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())); client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())),
} catch (e: any) { ).toBeRejectedWith(
assert(e.code === 30); jasmine.objectContaining({
return; code: 30,
} finally { }),
client.disconnect(); );
}
throw new Error("tx should have failed because of past timeoutHeight"); client.disconnect();
}); });
}); });
}); });

View File

@ -969,16 +969,15 @@ describe("SigningStargateClient", () => {
const height = await client.getHeight(); const height = await client.getHeight();
const signed = await client.sign(faucet.address0, [msgAny], fee, memo, undefined, BigInt(height - 1)); const signed = await client.sign(faucet.address0, [msgAny], fee, memo, undefined, BigInt(height - 1));
try { await expectAsync(
await client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())); client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())),
} catch (e: any) { ).toBeRejectedWith(
assert(e.code === 30); jasmine.objectContaining({
return; code: 30,
} finally { }),
client.disconnect(); );
}
throw new Error("tx should have failed because of past timeoutHeight"); client.disconnect();
}); });
}); });
@ -1248,16 +1247,15 @@ describe("SigningStargateClient", () => {
const height = await client.getHeight(); const height = await client.getHeight();
const signed = await client.sign(faucet.address0, [msgAny], fee, memo, undefined, BigInt(height - 1)); const signed = await client.sign(faucet.address0, [msgAny], fee, memo, undefined, BigInt(height - 1));
try { await expectAsync(
await client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())); client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())),
} catch (e: any) { ).toBeRejectedWith(
assert(e.code === 30); jasmine.objectContaining({
return; code: 30,
} finally { }),
client.disconnect(); );
}
throw new Error("tx should have failed because of past timeoutHeight"); client.disconnect();
}); });
}); });
}); });