aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion/test_mood.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/companion/test_mood.js')
-rw-r--r--desktop/companion/test_mood.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/desktop/companion/test_mood.js b/desktop/companion/test_mood.js
index 37af2ea..105648c 100644
--- a/desktop/companion/test_mood.js
+++ b/desktop/companion/test_mood.js
@@ -27,7 +27,7 @@ const L = new Function(lsrc + "\nreturn { parse, toggle, outputs };")();
const NOW = 10000000;
// A snapshot with nothing going on, overridden per case.
const calm = over => Object.assign({
- now: NOW, destructAt: 0, dodging: false, shoved: false, shovedAt: 0, recording: false, busy: false,
+ leaving: false, now: NOW, destructAt: 0, dodging: false, shoved: false, shovedAt: 0, recording: false, busy: false,
repliedAt: 0, clicks: { count: 0, at: 0 }, mockAt: 0, typingAt: 0, wakeAt: 0, admireAt: 0,
monologue: false, idle: 0,
}, over);
@@ -40,6 +40,7 @@ assert.deepStrictEqual(M.pick(calm({})), { state: "base", frame: "base" });
// The priority table, top to bottom: with every trigger from a row down
// active at once, that row wins. Merged so a higher row's values win.
const ladder = [
+ ["bye", { leaving: true }],
["destruct", { destructAt: NOW - 10 }],
["scorched", { destructAt: NOW - M.T.destruct - 10 }],
["dodge", { dodging: true }],
@@ -60,6 +61,11 @@ for (let i = 0; i < ladder.length; i++) {
assert.strictEqual(state(all), ladder[i][0], "everything from " + ladder[i][0] + " down");
}
+// A hide: she waves goodbye, above everything else, whatever she was doing.
+assert.deepStrictEqual(
+ M.pick(calm({ leaving: true, idle: 3, clicks: { count: 3, at: NOW - 10 } })),
+ { state: "bye", frame: "wave" });
+
// Shoved: knocked off balance for a moment, then mad beside the balloon
// for as long as it stays.
assert.deepStrictEqual(M.pick(calm({ shoved: true, shovedAt: NOW - 10 })), { state: "shoved", frame: "shoved" });