I am about to write some tests to verify some method functionality.
The method functionality is quite simple:
function checkAmount(const store : storage) : storage is
block{
if Tezos.amount <= store.UserBalance then skip else failwith("Not enought amount.");
} with store
Testmethod:
it("TestCheckAmount", async function() {
const instance = await Test.deployed();
await assert.rejects(
instance.checkAmount(),
(err) => {
assert.strictEqual(err.message, "Not enought amount.");
return true;
},
"No error is emitted"
);
});
Question: How is it possible to manipulate Tezos.amount? This property is always 0tez.
Also I want to cleanup the storage after every tests. I already saw that it is possible to define a afterEach method. But how can I cleanup the storage completely?
const storage = await instance.storage();
//Storage cleanup
storage.Clean()?!?!?
Thanks in advance!!!