etape3testavantdeploementok

This commit is contained in:
2026-10-20 12:19:21 +02:00
parent d2171d3f69
commit 1ee10e1ba0
3 changed files with 59 additions and 1 deletions

View 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,
);
});
});