Merge pull request #20 from status-im/fix-tests
minAt NOW to avoid failing in next test files
This commit is contained in:
commit
4f9c711678
|
@ -33,8 +33,8 @@ library RedeemUtil {
|
||||||
require(_redeem.blockNumber >= (block.number - _maxTxDelayInBlocks), "transaction too old");
|
require(_redeem.blockNumber >= (block.number - _maxTxDelayInBlocks), "transaction too old");
|
||||||
require(_redeem.blockHash == blockhash(_redeem.blockNumber), "invalid block hash");
|
require(_redeem.blockHash == blockhash(_redeem.blockNumber), "invalid block hash");
|
||||||
|
|
||||||
require(block.timestamp < _expirationTime, "expired gift");
|
require(block.timestamp < _expirationTime, "expired gift");
|
||||||
require(block.timestamp > _startTime, "reedeming not yet started");
|
require(block.timestamp > _startTime, "reedeming not yet started");
|
||||||
}
|
}
|
||||||
|
|
||||||
function hashRedeem(Redeem memory _redeem) internal pure returns (bytes32) {
|
function hashRedeem(Redeem memory _redeem) internal pure returns (bytes32) {
|
||||||
|
@ -79,4 +79,4 @@ library RedeemUtil {
|
||||||
bytes32 codeHash = keccak256(abi.encodePacked(_redeem.code));
|
bytes32 codeHash = keccak256(abi.encodePacked(_redeem.code));
|
||||||
require(codeHash == _code, "invalid code");
|
require(codeHash == _code, "invalid code");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ contract("GiftBucket", function () {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.match(e.message, /invalid block hash/);
|
assert.match(e.message, /invalid block hash/);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can redeem before expiration date", async function() {
|
it("can redeem before expiration date", async function() {
|
||||||
const block = await web3.eth.getBlock("latest");
|
const block = await web3.eth.getBlock("latest");
|
||||||
|
@ -398,5 +398,6 @@ contract("GiftBucket", function () {
|
||||||
it("shop can kill contract after expirationTime", async function() {
|
it("shop can kill contract after expirationTime", async function() {
|
||||||
await mineAt(EXPIRATION_TIME);
|
await mineAt(EXPIRATION_TIME);
|
||||||
await testKill();
|
await testKill();
|
||||||
|
await mineAt(NOW);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -205,7 +205,7 @@ contract("NFTBucket", function () {
|
||||||
assert.match(e.message, /only the NFT/);
|
assert.match(e.message, /only the NFT/);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function testRedeem(receiver, recipient, signer, relayer, redeemCode, blockNumber, blockHash) {
|
async function testRedeem(receiver, recipient, signer, relayer, redeemCode, blockNumber, blockHash) {
|
||||||
let gift = await NFTBucket.methods.gifts(recipient).call();
|
let gift = await NFTBucket.methods.gifts(recipient).call();
|
||||||
|
@ -295,7 +295,7 @@ contract("NFTBucket", function () {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.match(e.message, /invalid block hash/);
|
assert.match(e.message, /invalid block hash/);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can redeem before expiration date", async function() {
|
it("can redeem before expiration date", async function() {
|
||||||
const block = await web3.eth.getBlock("latest");
|
const block = await web3.eth.getBlock("latest");
|
||||||
|
@ -322,5 +322,6 @@ contract("NFTBucket", function () {
|
||||||
it("shop can kill contract after expirationTime", async function() {
|
it("shop can kill contract after expirationTime", async function() {
|
||||||
await mineAt(EXPIRATION_TIME);
|
await mineAt(EXPIRATION_TIME);
|
||||||
await testKill();
|
await testKill();
|
||||||
|
await mineAt(NOW);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue