mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
bafdf8d9f2
Update all tests for `no-var` and `prefer-arrow-callback` (using `--fix`)
34 lines
858 B
JavaScript
34 lines
858 B
JavaScript
const test = require('tap').test;
|
|
const Clock = require('../../src/io/clock');
|
|
const Runtime = require('../../src/engine/runtime');
|
|
|
|
test('spec', t => {
|
|
const rt = new Runtime();
|
|
const c = new Clock(rt);
|
|
|
|
t.type(Clock, 'function');
|
|
t.type(c, 'object');
|
|
t.type(c.projectTimer, 'function');
|
|
t.type(c.pause, 'function');
|
|
t.type(c.resume, 'function');
|
|
t.type(c.resetProjectTimer, 'function');
|
|
t.end();
|
|
});
|
|
|
|
test('cycle', t => {
|
|
const rt = new Runtime();
|
|
const c = new Clock(rt);
|
|
|
|
t.ok(c.projectTimer() <= 0.1);
|
|
setTimeout(() => {
|
|
c.resetProjectTimer();
|
|
setTimeout(() => {
|
|
t.ok(c.projectTimer() > 0);
|
|
c.pause();
|
|
t.ok(c.projectTimer() > 0);
|
|
c.resume();
|
|
t.ok(c.projectTimer() > 0);
|
|
t.end();
|
|
}, 100);
|
|
}, 100);
|
|
});
|