Luigit
repositories / Unfugwart

Unfugwart

Discord caretaker for Abteilung Unfug

owned by admin

test/readiness.test.js

Raw
import test from 'node:test';
import assert from 'node:assert/strict';
import { ShardReadiness } from '../readiness.js';

test('initial bootstrap identifies ready shards and ignores pre-bootstrap ShardReady', () => {
  const readiness = new ShardReadiness();
  assert.equal(readiness.ready(1), false);
  readiness.bootstrap([0, 1]);
  assert.equal(readiness.has(0), true);
  assert.equal(readiness.has(1), true);
});

test('re-identification after reconnect requires a new ready or resume event', () => {
  const readiness = new ShardReadiness();
  readiness.bootstrap([0]);
  readiness.unavailable(0);
  assert.equal(readiness.has(0), false);
  assert.equal(readiness.ready(0), true);
  readiness.unavailable(0);
  assert.equal(readiness.resume(0), true);
});