From 472d54260fa5be781fd01288e7006dd5ffaba77a Mon Sep 17 00:00:00 2001 From: nprimo Date: Tue, 6 Feb 2024 13:47:14 +0100 Subject: [PATCH] feat(usable-token): update test - Expect allowance to be a mapping(address => uint) --- tests/sol/usable-token.test.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/sol/usable-token.test.js b/tests/sol/usable-token.test.js index 4e6ffb3..945640e 100644 --- a/tests/sol/usable-token.test.js +++ b/tests/sol/usable-token.test.js @@ -1,36 +1,36 @@ -const { expect } = require("chai") +const { expect } = require('chai') -describe("Usable token (Allowances)", function() { +describe('Usable token (Allowances)', function () { let minito, owner, alice, bob - beforeEach(async ()=>{ - const contractDeployer = await ethers.getContractFactory("UsableToken"); - [owner, alice, bob] = await ethers.getSigners() + beforeEach(async () => { + const contractDeployer = await ethers.getContractFactory('UsableToken') + ;[owner, alice, bob] = await ethers.getSigners() minito = await contractDeployer.deploy(200) await minito.deployed() }) - it("Deploy account should have 200 units ", async function() { + it('Deploy account should have 200 units ', async function () { expect(await minito.accounts(owner.address)).to.equal(200) }) - it("Too large transaction should fail", async function() { - await expect( minito.transfer(alice.address, 2000)).to.be.reverted + it('Too large transaction should fail', async function () { + await expect(minito.transfer(alice.address, 2000)).to.be.reverted }) - it("Transfer should change balances", async function() { + it('Transfer should change balances', async function () { await minito.transfer(alice.address, 150) expect(await minito.accounts(alice.address)).to.equal(150) - }) - it("Owner can approve and allowance corresponds", async function() { + it('Owner can approve and allowance corresponds', async function () { await minito.approve(alice.address, 23) - expect(await minito.allowance(owner.address, alice.address)).to.equal(23) + expect(await minito.allowance(alice.address)).to.equal(23) }) - it("Too large transferFrom should fail", async function() { + it('Too large transferFrom should fail', async function () { await minito.approve(bob.address, 23) - await expect( minito.connect(bob).transferFrom(owner.address, alice.address, 2000)).to.be.reverted + await expect( + minito.connect(bob).transferFrom(owner.address, alice.address, 2000), + ).to.be.reverted }) - })