-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathImplementation.test.js
41 lines (34 loc) · 1.34 KB
/
Implementation.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// tests/Implementation.test.js
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("Implementation Contract", function () {
let Implementation, implementation;
beforeEach(async function () {
Implementation = await ethers.getContractFactory("Implementation");
implementation = await Implementation.deploy();
await implementation.deployed();
});
it("should set and get value correctly", async function () {
await implementation.setValue(42);
const value = await implementation.getValue();
expect(value).to.equal(42);
});
it("should increment value correctly", async function () {
await implementation.setValue(10);
await implementation.incrementValue();
const value = await implementation.getValue();
expect(value).to.equal(11);
});
it("should decrement value correctly", async function () {
await implementation.setValue(10);
await implementation.decrementValue();
const value = await implementation.getValue();
expect(value).to.equal(9);
});
it("should reset value to zero", async function () {
await implementation.setValue(10);
await implementation.resetValue();
const value = await implementation.getValue();
expect(value).to.equal(0);
});
});