UNPKG

thenavisapp

Version:

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

49 lines (37 loc) 1.91 kB
// SPDX-License-Identifier: MIT const { expect } = require("chai"); const NEscrow = artifacts.require("NEscrow"); contract("NEscrow", (accounts) => { let nEscrowInstance; before(async () => { nEscrowInstance = await NEscrow.deployed(); }); it("should deploy NEscrow contract", async () => { expect(nEscrowInstance.address).to.exist; }); it("should allow users to create escrow", async () => { // Assuming you have a function for users to create an escrow await nEscrowInstance.createEscrow(accounts[1], 1 ether, { from: accounts[0] }); // Add assertions based on the expected behavior of creating an escrow const escrowDetails = await nEscrowInstance.getEscrowDetails(0); expect(escrowDetails).to.exist; expect(escrowDetails.sender).to.equal(accounts[0]); expect(escrowDetails.receiver).to.equal(accounts[1]); expect(escrowDetails.amount.toNumber()).to.equal(1 ether); }); it("should allow users to release funds from escrow", async () => { // Assuming you have a function for releasing funds from an escrow await nEscrowInstance.releaseFunds(0, { from: accounts[0] }); // Add assertions based on the expected behavior of releasing funds const escrowDetails = await nEscrowInstance.getEscrowDetails(0); expect(escrowDetails.state.toNumber()).to.equal(2); // Check the state after release }); it("should allow users to refund escrow", async () => { // Assuming you have a function for refunding an escrow await nEscrowInstance.refundEscrow(0, { from: accounts[0] }); // Add assertions based on the expected behavior of refunding const escrowDetails = await nEscrowInstance.getEscrowDetails(0); expect(escrowDetails.state.toNumber()).to.equal(3); // Check the state after refund }); // Add more tests based on your contract's functionality });