File: now-test.js

package info (click to toggle)
node-d3-timer 1.0.9-2~bpo10%2B1
  • links: PTS, VCS
  • area: main
  • in suites: buster-backports
  • size: 260 kB
  • sloc: makefile: 5
file content (21 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var tape = require("tape"),
    timer = require("../"),
    end = require("./end");

require("./inRange");

tape("now() returns the same time when called repeatedly", function(test) {
  var now = timer.now();
  test.ok(now > 0);
  test.equal(timer.now(), now);
  end(test);
});

tape("now() returns a different time when called after a timeout", function(test) {
  var then = timer.now();
  test.ok(then > 0);
  setTimeout(function() {
    test.inRange(timer.now() - then, 50 - 10, 50 + 1000);
    end(test);
  }, 50);
});