etape3testavantdeploementok
This commit is contained in:
35
tokenizerRendu/code/test/FGC42Forge.ts
Normal file
35
tokenizerRendu/code/test/FGC42Forge.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { expect } from "chai";
|
||||
import { network } from "hardhat";
|
||||
|
||||
const { ethers } = await network.create();
|
||||
|
||||
const INITIAL_SUPPLY = 1_000_000n * 10n ** 18n;
|
||||
|
||||
describe("FGC42Forge", function () {
|
||||
it("expose le nom, le symbole et la supply fixe au déployeur", async function () {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
const token = await ethers.deployContract("FGC42Forge");
|
||||
|
||||
expect(await token.name()).to.equal("FGC42Forge");
|
||||
expect(await token.symbol()).to.equal("FG42");
|
||||
expect(await token.decimals()).to.equal(18n);
|
||||
expect(await token.totalSupply()).to.equal(INITIAL_SUPPLY);
|
||||
expect(await token.balanceOf(deployer.address)).to.equal(INITIAL_SUPPLY);
|
||||
expect(await token.owner()).to.equal(deployer.address);
|
||||
});
|
||||
|
||||
it("permet un transfer ERC-20 classique", async function () {
|
||||
const [deployer, recipient] = await ethers.getSigners();
|
||||
const token = await ethers.deployContract("FGC42Forge");
|
||||
|
||||
const amount = 1_000n * 10n ** 18n;
|
||||
await expect(token.transfer(recipient.address, amount))
|
||||
.to.emit(token, "Transfer")
|
||||
.withArgs(deployer.address, recipient.address, amount);
|
||||
|
||||
expect(await token.balanceOf(recipient.address)).to.equal(amount);
|
||||
expect(await token.balanceOf(deployer.address)).to.equal(
|
||||
INITIAL_SUPPLY - amount,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user