import { expect } from "chai"; import { ethers } from "hardhat"; import { TestCircuitAttributeHandler } from "../../typechain-types"; import { CircuitAttributeHandler } from "../utils/formatter"; describe("CircuitAttributeHandler", function () { let testHandler: TestCircuitAttributeHandler; before(async function () { const TestHandlerFactory = await ethers.getContractFactory("TestCircuitAttributeHandler"); testHandler = await TestHandlerFactory.deploy(); await testHandler.waitForDeployment(); }); const mrz = ethers.toUtf8Bytes( "P CircuitAttributeHandler.extractStringAttribute(shortMRZ, 0, 5)).to.throw("InsufficientCharcodeLen"); }); it("should match contract and ts implementation for empty range", async function () { const contractResult = await testHandler.testExtractStringAttribute(sampleMRZ, 2, 2); const tsResult = CircuitAttributeHandler.extractStringAttribute(sampleMRZ, 2, 2); expect(contractResult).to.equal(tsResult); expect(contractResult).to.equal("U"); }); }); });