How to convert the value in big number in solidity using truffle framework?

I am having this error while testing my contract. All of the tests are passing except the last one. I don't understand this error, please help. the smart contract is created with truffle framework.

my lottery-contract sol file:

// SPDX-License-Identifier: GPL-3.0
      pragma solidity >= 0.5.2;
      contract Lottery{
    address public manager;
    address[] public players;
    constructor()public{
        manager=msg.sender;
        
    }
    function enter() public payable{
        require(msg.value>0.01 ether);
        players.push(msg.sender);
    }
    function random() private view returns(uint){
      return uint(keccak256(abi.encodePacked(block.difficulty,block.timestamp,players)));
    }
    function getBalance() public view returns(uint){
        return address(this).balance;
    }
    function pickWinner() public restricted {
        address payable winner;
        uint index=random()% players.length;
        winner=payable(players[index]);
        winner.transfer(getBalance());
       players=new address[](0);
    }
    modifier restricted(){
        require(msg.sender==manager);
        _;
    }
    function getPlayers() public view returns(address[] memory){
        return players;
    }}

lottery test file

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());
const Lottery = artifacts.require('Lottery');
contract('Lottery', (accounts) => {
  let lottery;
  beforeEach(async () => {
    lottery = await Lottery.new({ from: accounts[0] });
  });

  describe('Lottery Contract', () => {
    it('deploys a contract', () => {
      assert.ok(lottery.address);
    });
    it('allows one acc to enter', async () => {
      await lottery.enter({
        from: accounts[0],
        value: web3.utils.toWei('0.02', 'ether'),
      });
      const players = await lottery.getPlayers({ from: accounts[0] });

      assert.equal(accounts[0], players[0]);
      assert.equal(1, players.length);
    });
    it('allows multiple acc to enter', async () => {
      await lottery.enter({
        from: accounts[0],
        value: web3.utils.toWei('0.02', 'ether'),
      });
      await lottery.enter({
        from: accounts[1],
        value: web3.utils.toWei('0.02', 'ether'),
      });
      await lottery.enter({
        from: accounts[2],
        value: web3.utils.toWei('0.02', 'ether'),
      });
      const players = await lottery.getPlayers({ from: accounts[0] });

      assert.equal(accounts[0], players[0]);
      assert.equal(accounts[1], players[1]);
      assert.equal(accounts[2], players[2]);
      assert.equal(3, players.length);
    });
    it('requires a min amount of ether to enter', async () => {
      try {
        await lottery.enter({
          from: accounts[0],
          value: 0,
        });
        assert(false);
      } catch (err) {
        assert(err);
      }
    });

    it('only manager can call pickWinner', async () => {
      try {
        await lottery.pickWinner({
          from: accounts[1],
        });
        assert(false);
      } catch (err) {
        assert(err);
      }
    });
    it('sends money to the winner and resets the players', async () => {
      await lottery.enter({
        from: accounts[0],
        value: web3.utils.toWei('2', 'ether'),
      });
      const initialBal = await web3.eth.getBalance(accounts[0]);
      await lottery.pickWinner({
        from: accounts[0],
      });
      const finalBal = await web3.eth.getBalance(accounts[0]);
      const difference = finalBal - initialBal;
      console.log(difference);
      assert(difference > web3.utils.toWei('1.8', 'ether'));
    });
  });
});

I am having this error, please tell me how to do the conversion. It shows the last test is not passing, please help I am a beginner. error


Your truffle.config.js has no connection to ganache.

add this to your truffle-config.js

networks: {
    development: {
      host: "127.0.0.1", 
      // default ganache gui listens to 7545
      port: 7545, 
      network_id: "*", 
    },

Make sure your ganache is running and run the test.