uploadtimer.spec.js 796 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const assert = require('assert');
  3. const UploadTimer = require('../lib/uploadtimer');
  4. describe('Test UploadTimer class', () => {
  5. it('It runs a callback function after specified timeout.', (done) => {
  6. const uploadTimer = new UploadTimer(1000, done);
  7. uploadTimer.set();
  8. });
  9. it('set method returns true if timeout specified.', () => {
  10. const uploadTimer = new UploadTimer(1000);
  11. assert.equal(uploadTimer.set(), true);
  12. });
  13. it('set method returns false if timeout has not specified.', () => {
  14. const uploadTimer = new UploadTimer();
  15. assert.equal(uploadTimer.set(), false);
  16. });
  17. it('set method returns false if zero timeout has specified.', () => {
  18. const uploadTimer = new UploadTimer(0);
  19. assert.equal(uploadTimer.set(), false);
  20. });
  21. });