thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
63 lines (41 loc) • 2.12 kB
JavaScript
// SPDX-License-Identifier: MIT
const { expect } = require("chai");
const NAVISToken = artifacts.require("NAVISToken");
contract("NAVISToken", (accounts) => {
let navisToken;
const owner = accounts[0];
const user1 = accounts[1];
before(async () => {
navisToken = await NAVISToken.new(/* constructor parameters */);
});
it("should deploy with the correct name and symbol", async () => {
const name = await navisToken.name();
const symbol = await navisToken.symbol();
expect(name).to.equal("NAVIS");
expect(symbol).to.equal("NAVIS");
});
it("should mint initial supply to the owner", async () => {
const ownerBalance = await navisToken.balanceOf(owner);
// Replace with the actual initial supply value
const expectedOwnerBalance = web3.utils.toBN(/* initial supply value */);
expect(ownerBalance).to.be.bignumber.equal(expectedOwnerBalance);
});
it("should convert BTC to NAVIS", async () => {
const btcAmount = 1; // Replace with the desired BTC amount for testing
await navisToken.convertBTCToNAVIS(btcAmount, { from: user1 });
const user1Balance = await navisToken.balanceOf(user1);
// Replace with the expected NAVIS amount based on the conversion ratio
const expectedUser1Balance = web3.utils.toBN(/* expected NAVIS amount */);
expect(user1Balance).to.be.bignumber.equal(expectedUser1Balance);
});
it("should mine tokens for the user", async () => {
const initialUserBalance = await navisToken.balanceOf(user1);
// Call the mineTokens function or other relevant mining function
await navisToken.mineTokens(/* specify the amount */, { from: user1 });
const finalUserBalance = await navisToken.balanceOf(user1);
// Replace with the expected mined tokens based on the mining reward
const expectedMinedTokens = web3.utils.toBN(/* expected mined tokens */);
expect(finalUserBalance.sub(initialUserBalance)).to.be.bignumber.equal(expectedMinedTokens);
});
// Add more test cases for other functions and features...
});