From 7481ebb8176a6fcbb0cb681a8350c618d821acad Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 21 Dec 2020 16:13:49 +0000 Subject: [PATCH] Add regression test for NFTPAR-197 --- --- a/tests/src/accounts.ts +++ b/tests/src/accounts.ts @@ -1,2 +1,3 @@ export const bobsPublicKey = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; export const alicesPublicKey = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; +export const ferdiesPublicKey = '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL'; --- a/tests/src/transfer.test.ts +++ b/tests/src/transfer.test.ts @@ -1,6 +1,6 @@ -import { expect } from "chai"; +import { expect, assert } from "chai"; import { default as usingApi, submitTransactionAsync } from "./substrate/substrate-api"; -import { alicesPublicKey, bobsPublicKey } from "./accounts"; +import { alicesPublicKey, bobsPublicKey, ferdiesPublicKey } from "./accounts"; import privateKey from "./substrate/privateKey"; import getBalance from "./substrate/get-balance"; @@ -20,4 +20,22 @@ expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true; }); }); + + it('Inability to pay fees error message is correct', async () => { + await usingApi(async api => { + const pk = privateKey('//Ferdie'); + + console.log = function () {}; + console.error = function () {}; + + const badTransfer = api.tx.balances.transfer(bobsPublicKey, 1n); + const badTransaction = async function () { + const result = await submitTransactionAsync(pk, badTransfer); + }; + await expect(badTransaction()).to.be.rejectedWith("Inability to pay some fees"); + + delete console.log; + delete console.error; + }); + }); }); -- gitstuff