thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
37 lines (27 loc) • 1.38 kB
JavaScript
// SPDX-License-Identifier: MIT
const { expect } = require("chai");
const NFarming = artifacts.require("NFarming");
contract("NFarming", (accounts) => {
let nFarmingInstance;
before(async () => {
nFarmingInstance = await NFarming.deployed();
});
it("should deploy NFarming contract", async () => {
expect(nFarmingInstance.address).to.exist;
});
it("should allow users to stake tokens", async () => {
// Assuming you have a function for users to stake tokens
await nFarmingInstance.stakeTokens(web3.utils.toWei("100", "ether"), { from: accounts[0] });
// Add assertions based on the expected behavior of staking tokens
const userStake = await nFarmingInstance.getUserStake(accounts[0]);
expect(userStake.amount.toString()).to.equal(web3.utils.toWei("100", "ether"));
});
it("should allow users to unstake tokens", async () => {
// Assuming you have a function for users to unstake tokens
await nFarmingInstance.unstakeTokens(web3.utils.toWei("50", "ether"), { from: accounts[0] });
// Add assertions based on the expected behavior of unstaking tokens
const userStake = await nFarmingInstance.getUserStake(accounts[0]);
expect(userStake.amount.toString()).to.equal(web3.utils.toWei("50", "ether"));
});
// Add more tests based on your contract's functionality
});