-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogvm.test.js
More file actions
53 lines (52 loc) · 1.54 KB
/
progvm.test.js
File metadata and controls
53 lines (52 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {
BaseSpeed,
ProgVm,
SpeedMultiplier,
__toESM,
require_cjs
} from "./chunk-2UASDXKQ.js";
// progvm.test.ts
var import_rxjs = __toESM(require_cjs(), 1);
import { equal, notEqual, ok } from "node:assert/strict";
import { describe, it } from "node:test";
describe("ProgVm", () => {
it("pauses", async () => {
const prog = new ProgVm();
prog.pause();
const paused = await (0, import_rxjs.firstValueFrom)(prog.paused);
equal(paused, true);
});
it("unpauses", async () => {
const prog = new ProgVm();
prog.pause();
prog.unpause();
const paused = await (0, import_rxjs.firstValueFrom)(prog.paused);
equal(paused, false);
});
it("speeds up", async () => {
const prog = new ProgVm();
prog.speedUp();
const perTick = await (0, import_rxjs.firstValueFrom)(prog.perTick);
equal(perTick, BaseSpeed * SpeedMultiplier);
});
it("slows down", async () => {
const prog = new ProgVm();
prog.slowDown();
const perTick = await (0, import_rxjs.firstValueFrom)(prog.perTick);
equal(perTick, BaseSpeed / SpeedMultiplier);
});
it("finishes", async () => {
const prog = new ProgVm();
prog.finish();
const percent = await (0, import_rxjs.firstValueFrom)(prog.percent);
equal(percent, 1);
});
it("ticks forward", async () => {
const prog = new ProgVm();
const start = await (0, import_rxjs.firstValueFrom)(prog.percent);
await prog.tick();
const end = await (0, import_rxjs.firstValueFrom)(prog.percent);
notEqual(start, end);
ok(end > start);
});
});