thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
46 lines (34 loc) • 1.57 kB
JavaScript
// SPDX-License-Identifier: MIT
const { expect } = require("chai");
const NAVISOracle = artifacts.require("NAVISOracle");
contract("NAVISOracle", (accounts) => {
let navisOracleInstance;
before(async () => {
navisOracleInstance = await NAVISOracle.deployed();
});
it("should deploy NAVISOracle contract", async () => {
expect(navisOracleInstance.address).to.exist;
});
it("should request and receive a valid delivery time estimate", async () => {
const newRoute = "Sample route details";
// Request delivery time estimate
await navisOracleInstance.requestDeliveryTimeEstimate(newRoute);
// You may need to wait for the oracle to respond and check the estimated time
const estimatedTime = await navisOracleInstance.getEstimatedDeliveryTime();
// Add assertions based on the expected behavior of your oracle
expect(estimatedTime).to.be.a("number");
expect(estimatedTime).to.be.above(0);
});
it("should revert if requesting a delivery time estimate with invalid route", async () => {
const invalidRoute = ""; // Set an invalid route
// Try to request delivery time estimate with an invalid route
try {
await navisOracleInstance.requestDeliveryTimeEstimate(invalidRoute);
// 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
});