test(e2e): stabilize suite

This commit is contained in:
Peter Steinberger
2026-02-14 20:54:31 +01:00
parent 2a3da21333
commit c06a962bb6
15 changed files with 238 additions and 84 deletions

View File

@@ -44,6 +44,18 @@ type AnnounceQueueState = {
const ANNOUNCE_QUEUES = new Map<string, AnnounceQueueState>();
export function resetAnnounceQueuesForTests() {
// Test isolation: other suites may leave a draining queue behind in the worker.
// Clearing the map alone isn't enough because drain loops capture `queue` by reference.
for (const queue of ANNOUNCE_QUEUES.values()) {
queue.items.length = 0;
queue.summaryLines.length = 0;
queue.droppedCount = 0;
queue.lastEnqueuedAt = 0;
}
ANNOUNCE_QUEUES.clear();
}
function getAnnounceQueue(
key: string,
settings: AnnounceQueueSettings,