You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
796 B
29 lines
796 B
4 years ago
|
'use strict';
|
||
|
|
||
|
const assert = require('assert');
|
||
|
const UploadTimer = require('../lib/uploadtimer');
|
||
|
|
||
|
describe('Test UploadTimer class', () => {
|
||
|
|
||
|
it('It runs a callback function after specified timeout.', (done) => {
|
||
|
const uploadTimer = new UploadTimer(1000, done);
|
||
|
uploadTimer.set();
|
||
|
});
|
||
|
|
||
|
it('set method returns true if timeout specified.', () => {
|
||
|
const uploadTimer = new UploadTimer(1000);
|
||
|
assert.equal(uploadTimer.set(), true);
|
||
|
});
|
||
|
|
||
|
it('set method returns false if timeout has not specified.', () => {
|
||
|
const uploadTimer = new UploadTimer();
|
||
|
assert.equal(uploadTimer.set(), false);
|
||
|
});
|
||
|
|
||
|
it('set method returns false if zero timeout has specified.', () => {
|
||
|
const uploadTimer = new UploadTimer(0);
|
||
|
assert.equal(uploadTimer.set(), false);
|
||
|
});
|
||
|
|
||
|
});
|