Files
linea-monorepo/contracts/test/lib/Utils.ts
The Dark Jester 4af87b5fe6 [Chore] - First pass contracts and makefile cleanup (#276)
* first pass contracts and makefile cleanup

* remove unused 4844 test files

* Remove Goerli references

* lint fixing

* lint fixing

* remove more Goerli references

* correct folder paths for L2 service tests

* fix pathing and hardhat version

* reinstate deleted file

* correct file pathing
2024-11-06 02:21:14 -08:00

26 lines
965 B
TypeScript

import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import { expect } from "chai";
import { TestUtils } from "../../typechain-types";
import { deployFromFactory } from "../common/deployment";
import { generateKeccak256, generateRandomBytes } from "../common/helpers";
describe("Utils Library", () => {
let contract: TestUtils;
async function deployTestUtilsFixture() {
return deployFromFactory("TestUtils");
}
beforeEach(async () => {
contract = (await loadFixture(deployTestUtilsFixture)) as TestUtils;
});
describe("efficientKeccak", () => {
it("Should return the correct keccak hash", async () => {
const leftValue = generateRandomBytes(32);
const rightValue = generateRandomBytes(32);
const solidityKeccakHash = generateKeccak256(["bytes32", "bytes32"], [leftValue, rightValue]);
expect(await contract.efficientKeccak(leftValue, rightValue)).to.equal(solidityKeccakHash);
});
});
});