40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { expect } from 'chai'
|
|
import hre from "hardhat";
|
|
import {
|
|
getBytes,
|
|
solidityPackedKeccak256,
|
|
} from 'ethers'
|
|
import {
|
|
loadFixture,
|
|
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
|
|
|
|
describe('TestBit', function() {
|
|
async function deployOneContract() {
|
|
// Contracts are deployed using the first signer/account by default
|
|
const [owner, otherAccount] = await hre.ethers.getSigners();
|
|
const verifier = owner.address;
|
|
|
|
const TestBit = await hre.ethers.getContractFactory("TestBit");
|
|
|
|
const testBit = await TestBit.deploy( );
|
|
const chainId = hre.network.config.chainId
|
|
|
|
return { testBit, owner, otherAccount, verifier, chainId };
|
|
}
|
|
describe("Deployment", function () {
|
|
it('should deploy TestBit', async function() {
|
|
const { testBit } = await loadFixture(deployOneContract);
|
|
|
|
const idx = '0';
|
|
const initVal = 0;
|
|
await testBit.setVal(idx, initVal);
|
|
const nextVal = 0 << 1
|
|
await expect(testBit.checkVal(idx, nextVal))
|
|
.to.emit(testBit, "ValueChecked")
|
|
.withArgs(0, nextVal | initVal);
|
|
});
|
|
|
|
})
|
|
|
|
|
|
}) |