Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofwedrowicz committed Jan 16, 2019
1 parent e6f484a commit e8e915e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/OracleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const timeController = require('./utils/timeController');
const Oracle = artifacts.require('Oracle');
const UsingOracle = artifacts.require('UsingOracle');

const ONE_DAY = 60 * 60 * 24;

contract('Oracle', (accounts) => {
const sut = {};
const serverAddress = accounts[1];
Expand Down Expand Up @@ -185,10 +187,11 @@ contract('Oracle', (accounts) => {
it('should emit RequestFullfilled event when fulfill request with valid delay as timestamp', async () => {
// given
const url = 'someurl.example.com';
const delayAsTimestamp = 1546300800; // 2020/01/01 as unix timestamp.
const delayAsTimestamp = timeController.currentTimestamp().add(ONE_DAY);

const transaction = await sut.usingOracle.delayedRequest(url, delayAsTimestamp);
const { blockNumber } = transaction.receipt;
timeController.addDays(100); // Adding 15 months from now.
timeController.addDays(1);
const events = await getEvents(
sut.instance,
{ eventName: 'DelayedDataRequested', eventArgs: {} },
Expand All @@ -210,7 +213,7 @@ contract('Oracle', (accounts) => {
it('should reject fulfilling request for invalid request delay as timestamp', async () => {
// given
const url = 'someurl.example.com';
const delayInSeconds = 1577836802;
const delayInSeconds = timeController.currentTimestamp().add(ONE_DAY);
const transaction = await sut.usingOracle.delayedRequest(url, delayInSeconds);
const { blockNumber } = transaction.receipt;
const events = await getEvents(
Expand Down

0 comments on commit e8e915e

Please sign in to comment.