This seems to be working fine:
contract("Sale", function(accounts) {
let sale;
let fromAddr = accounts[0];
let amountToSend = "1000000000000000000";
before(async function() {
sale = await artifacts.require("Sale").new();
});
it("Test if can be payed", async function() {
let res = await web3.eth.sendTransaction({
from: fromAddr,
to: sale.address,
value: amountToSend
});
// if we reach here then the transaction has completed successfully
});
it("Test if contract received ether", async function() {
let res = await web3.eth.getBalance(sale.address);
assert(res.greaterThanOrEqualTo(amountToSend));
});
it("Catch if balanceOf "+fromAddr, async function() {
let res = await sale.balanceOf.call(fromAddr);
assert(res.greaterThanOrEqualTo(1));
});
});