Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@digix/tempo

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digix/tempo

Testing tool: Time management over RPC

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
105
452.63%
Maintainers
2
Weekly downloads
 
Created
Source

Tempo

A simple tool for time management in truffle testrpc tests

const { wait, waitUntilBlock } = require('@digix/tempo');
// wait will wait for `n` blocks; (seconds, blocks), default (20, 1)
// waitUntilBlock will wait until `n` specific block; (seconds, blockNumber)

contract('MockLibraryUser', function () {
  it('get_last_payment_date returns correct time when its not set', async function () {
    const mockLibraryUser = await MockLibraryUser.deployed();
    await mockLibraryUser.create_user(testUser);
    const lastPayment1 = await mockLibraryUser.get_last_payment_date.call(testUser);
    const timeDiff1 = new Date().getTime() - (lastPayment1.toNumber() * 1000);
    assert.ok(timeDiff1 < 1000, 'unset date isnt `now`');
    await wait();
  });
});

License

MIT 2016

FAQs

Package last updated on 25 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts