timer.test.js 459 Bytes
let expect = require('expect.js');
let Timer = require('../../library/timer');


describe('/library/timer', function() { // eslint-disable-line
    it('延迟100ms,期望大于或等于100ms', function(done) {// eslint-disable-line
        let t = new Timer();

        t.put('aa');
        setTimeout(function() {
            let time = t.put('aa');

            expect(Math.round(time) >= 100).to.be.ok();
            done();
        }, 100);
    });
});