fix: a new message goes behind queued entries, not ahead of them

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:10:07 +01:00
1 parent cb7f7b58f5
commit 2dbb3fe23e
3 files changed
+32 -4

No files matched your search

+11
View File
@@ -105,3 +105,14 @@ test("shouldStartCountdown: stopped or closed gate blocks", () => {
test("shouldStartCountdown tolerates a non-array queue", () => {
assert.equal(shouldStartCountdown(sc({ queue: null })), false);
});
import { queueBlocksDirectSend } from "../mod/ovis-composer/delivery.js";
test("queueBlocksDirectSend: a message that waits (queued or counting down) goes first", () => {
assert.equal(queueBlocksDirectSend([{ state: "queued" }]), true);
assert.equal(queueBlocksDirectSend([{ state: "countdown" }]), true);
assert.equal(queueBlocksDirectSend([{ state: "held" }, { state: "uncertain" }]), false);
assert.equal(queueBlocksDirectSend([{ state: "sending" }]), false);
assert.equal(queueBlocksDirectSend([]), false);
assert.equal(queueBlocksDirectSend(undefined), false);
});