начале теста
it('test', async () => {
const saveState = async () => {
return await web3.currentProvider.send({
jsonrpc: "2.0",
method: "evm_snapshot",
id: 0
})
};
const revertState = async (id) => {
await web3.currentProvider.send({
jsonrpc: "2.0",
method: "evm_revert",
params: [id],
id: 0
})
};
let block = await web3.eth.getBlock('latest').timestamp;
console.log("before time manipulation", block)
let id = await saveState();
timeHelper.fastForward(10285822);
block = await web3.eth.getBlock('latest').timestamp;
console.log("after time manipulation", block);
await revertState(id);
block = await web3.eth.getBlock('latest').timestamp;
console.log("after state revert", block)
});
Получаю:
before time manipulation 1611522354
after time manipulation 1621808177
after state revert 1621808177
Почему он не делает реверт стейт?
a save state делает?
Обсуждают сегодня