thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
41 lines (31 loc) • 1.44 kB
JavaScript
// SPDX-License-Identifier: MIT
const { expect } = require("chai");
const NArbitrage = artifacts.require("NArbitrage");
contract("NArbitrage", (accounts) => {
let nArbitrageInstance;
const owner = accounts[0];
before(async () => {
nArbitrageInstance = await NArbitrage.deployed();
});
it("should deploy NArbitrage contract", async () => {
expect(nArbitrageInstance.address).to.exist;
});
it("should allow users to submit arbitrage opportunities", async () => {
const arbitrageOpportunity = "Opportunity details...";
await nArbitrageInstance.submitArbitrageOpportunity(arbitrageOpportunity, { from: accounts[1] });
const submittedOpportunity = await nArbitrageInstance.getArbitrageOpportunity(accounts[1]);
expect(submittedOpportunity).to.equal(arbitrageOpportunity);
});
it("should not allow unauthorized users to submit arbitrage opportunities", async () => {
const arbitrageOpportunity = "Opportunity details...";
// Try to submit from an unauthorized account
try {
await nArbitrageInstance.submitArbitrageOpportunity(arbitrageOpportunity, { from: accounts[2] });
// If the above line doesn't throw an error, fail the test
expect.fail("Should have thrown an error");
} catch (error) {
expect(error.message).to.include("revert");
}
});
// Add more tests based on your contract's functionality
});