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


describe('/library/timer', function() {
    it('延迟100ms,期望大于或等于100ms', function(done) {
        let t = new Timer();
        t.put('aa');
        setTimeout(function() {
            let time = t.put('aa');
            expect(Math.round(time) >= 100).to.be.ok();
            done();
        }, 100);
    });
});