mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
26 lines
590 B
JavaScript
26 lines
590 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { flyToAustin } from '../camera.js';
|
|
|
|
test('teardown before the initial camera delay prevents a late flight', (t) => {
|
|
t.mock.timers.enable({ apis: ['setTimeout'] });
|
|
let flights = 0;
|
|
let cancelled = 0;
|
|
const stop = flyToAustin({
|
|
isDestroyed: () => false,
|
|
camera: {
|
|
setView() {},
|
|
flyTo() {
|
|
flights++;
|
|
},
|
|
cancelFlight() {
|
|
cancelled++;
|
|
},
|
|
},
|
|
});
|
|
stop();
|
|
t.mock.timers.tick(1000);
|
|
assert.equal(flights, 0);
|
|
assert.equal(cancelled, 1);
|
|
});
|