Added Test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const { ethers } = require("hardhat");
|
||||
const { expect, assert } = require("chai");
|
||||
|
||||
describe("SimpleStorage", function () {
|
||||
let simpleStorageFactory;
|
||||
let simpleStorage;
|
||||
beforeEach(async function () {
|
||||
simpleStorageFactory = await ethers.getContractFactory("SimpleStorage");
|
||||
simpleStorage = await simpleStorageFactory.deploy();
|
||||
});
|
||||
|
||||
it("Should start with a favorite number of 123", async function () {
|
||||
const currentValue = await simpleStorage.viewMyNumber();
|
||||
const expectedValue = "123";
|
||||
// assert
|
||||
assert.equal(currentValue.toString(), expectedValue);
|
||||
|
||||
// expect
|
||||
//expect(currentValue.toString()).to.equal(expectedValue);
|
||||
});
|
||||
|
||||
// Run this specific test only!
|
||||
//it.only("Should update when we call storeMyNumber", async function () {
|
||||
it("Should update when we call storeMyNumber", async function () {
|
||||
const expectedValue = "7296";
|
||||
const transactionResponse =
|
||||
await simpleStorage.storeMyNumber(expectedValue);
|
||||
await transactionResponse.wait(1);
|
||||
|
||||
const currentValue = await simpleStorage.viewMyNumber();
|
||||
assert.equal(currentValue.toString(), expectedValue);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user