From 402c9f20c85d824529fbbf72f079d7aebdc1dc2b Mon Sep 17 00:00:00 2001 From: jia57b Date: Tue, 3 Dec 2024 10:12:43 +0800 Subject: [PATCH] update var name --- .../hardhat/e2e/permission/permission.test.ts | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/test/hardhat/e2e/permission/permission.test.ts b/test/hardhat/e2e/permission/permission.test.ts index 881d489c..d55979f3 100644 --- a/test/hardhat/e2e/permission/permission.test.ts +++ b/test/hardhat/e2e/permission/permission.test.ts @@ -17,9 +17,10 @@ describe("Permission", function () { const tokenId = await mintNFT(signers[0].address); const connectedRegistry = this.ipAssetRegistry.connect(signers[0]); const func = hre.ethers.encodeBytes32String("attachLicenseTerms").slice(0, 10); - console.log(func); const ALLOW_permission = 1; const DENY_permission = 2; + let permissionAfter: number; + let result: any; const ipId = await expect( connectedRegistry.register(this.chainId, MockERC721, tokenId) @@ -30,27 +31,24 @@ describe("Permission", function () { const connecedAccessController = this.accessController.connect(signers[0]); const permissionBefore = await connecedAccessController.getPermission(ipId, signers[0].address, LicensingModule, func); - console.log("permissionBefore:", permissionBefore); expect(permissionBefore).to.equal(0); // add ALLOW permission - const result1 = await connecedAccessController.setPermission(ipId, signers[0].address, LicensingModule, func, ALLOW_permission); - expect(result1.hash).to.not.be.empty.and.to.be.a("HexString"); - await result1.wait(); + result = await connecedAccessController.setPermission(ipId, signers[0].address, LicensingModule, func, ALLOW_permission); + expect(result.hash).to.not.be.empty.and.to.be.a("HexString"); + await result.wait(); - // get the permission - const permissionAfter1 = await connecedAccessController.getPermission(ipId, signers[0].address, LicensingModule, func); - console.log("permissionAfter:", permissionAfter1); - expect(permissionAfter1).to.equal(ALLOW_permission); + // check the permission + permissionAfter = await connecedAccessController.getPermission(ipId, signers[0].address, LicensingModule, func); + expect(permissionAfter).to.equal(ALLOW_permission); // Change to DENY permission - const result2 = await connecedAccessController.setPermission(ipId, signers[0].address, LicensingModule, func, DENY_permission); - expect(result2.hash).to.not.be.empty.and.to.be.a("HexString"); - await result2.wait(); - - // get the permission - const permissionAfter2 = await connecedAccessController.getPermission(ipId, signers[0].address, LicensingModule, func); - console.log("permissionAfter:", permissionAfter2); - expect(permissionAfter2).to.equal(DENY_permission); + result = await connecedAccessController.setPermission(ipId, signers[0].address, LicensingModule, func, DENY_permission); + expect(result.hash).to.not.be.empty.and.to.be.a("HexString"); + await result.wait(); + + // check the permission + permissionAfter = await connecedAccessController.getPermission(ipId, signers[0].address, LicensingModule, func); + expect(permissionAfter).to.equal(DENY_permission); }); }); \ No newline at end of file