diff --git a/contracts/test/EscrowService.test.js b/contracts/test/EscrowService.test.js index 7fddedae..31aa60f1 100644 --- a/contracts/test/EscrowService.test.js +++ b/contracts/test/EscrowService.test.js @@ -84,7 +84,7 @@ describe("EscrowService", function () { describe("Escrow Creation", function () { it("Should create standard escrow", async function () { - const tx = await escrowService.connect(depositor).createEscrow( + const escrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -93,10 +93,6 @@ describe("EscrowService", function () { 0, // Immediate release "Test escrow" ); - const receipt = await tx.wait(); - - const event = escrowService.interface.parseLog(receipt.logs[0]); - const escrowId = event.args[0]; expect(escrowId).to.not.be.undefined; }); @@ -147,7 +143,7 @@ describe("EscrowService", function () { let escrowId; beforeEach(async function () { - const tx = await escrowService.connect(depositor).createEscrow( + escrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -156,9 +152,6 @@ describe("EscrowService", function () { 0, "Test escrow" ); - const receipt = await tx.wait(); - const event = escrowService.interface.parseLog(receipt.logs[0]); - escrowId = event.args[0]; }); it("Should skip - fundEscrow not implemented", async function () { @@ -181,7 +174,7 @@ describe("EscrowService", function () { let escrowId; beforeEach(async function () { - const tx = await escrowService.connect(depositor).createEscrow( + escrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -190,9 +183,6 @@ describe("EscrowService", function () { 0, "Test escrow" ); - const receipt = await tx.wait(); - const event = escrowService.interface.parseLog(receipt.logs[0]); - escrowId = event.args[0]; }); it("Should release escrow to beneficiary", async function () { @@ -213,7 +203,7 @@ describe("EscrowService", function () { it("Should revert if time lock not passed", async function () { // Create new escrow const latestTime = await ethers.provider.getBlock('latest').then(b => b.timestamp); - const tx = await escrowService.connect(depositor).createEscrow( + const newEscrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -222,9 +212,6 @@ describe("EscrowService", function () { latestTime + 3600, "Test escrow" ); - const receipt = await tx.wait(); - const event = escrowService.interface.parseLog(receipt.logs[0]); - const newEscrowId = event.args[0]; await expect( escrowService.connect(depositor).releaseEscrow(newEscrowId, "Service completed") @@ -236,7 +223,7 @@ describe("EscrowService", function () { let escrowId; beforeEach(async function () { - const tx = await escrowService.connect(depositor).createEscrow( + escrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -245,9 +232,6 @@ describe("EscrowService", function () { 0, "Test escrow" ); - const receipt = await tx.wait(); - const event = escrowService.interface.parseLog(receipt.logs[0]); - escrowId = event.args[0]; }); it("Should refund escrow to depositor", async function () { @@ -304,7 +288,7 @@ describe("EscrowService", function () { let escrowId; beforeEach(async function () { - const tx = await escrowService.connect(depositor).createEscrow( + escrowId = await escrowService.connect(depositor).createEscrow( beneficiary.address, arbiter.address, ESCROW_AMOUNT, @@ -313,9 +297,6 @@ describe("EscrowService", function () { 0, "Test escrow" ); - const receipt = await tx.wait(); - const event = escrowService.interface.parseLog(receipt.logs[0]); - escrowId = event.args[0]; }); it("Should get escrow details", async function () {