Files
AstrBot/dashboard/tests/routerReadiness.test.mjs
エイカク a8ff2b3d9c fix(dashboard): stabilize sidebar hash navigation on startup (#6159)
* fix(dashboard): stabilize sidebar hash navigation on startup

* fix(dashboard): reuse shared extension tab route helpers

* fix(dashboard): avoid leaking extension route query state

* fix(dashboard): preserve route params in tab locations

* fix(dashboard): harden hash tab routing fallbacks

* fix(dashboard): warn on tab route navigation failures

* fix(dashboard): harden extension tab startup routing
2026-03-13 11:53:50 +09:00

30 lines
803 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
test('waitForRouterReadyInBackground returns immediately and logs failures', async () => {
const module = await import('../src/utils/routerReadiness.mjs').catch(() => null);
assert.ok(module?.waitForRouterReadyInBackground);
const error = new Error('router blocked');
let warned;
const readyPromise = Promise.reject(error);
const logger = {
warn: (message, cause) => {
warned = { message, cause };
},
};
const result = module.waitForRouterReadyInBackground(
{ isReady: () => readyPromise },
logger,
);
assert.equal(result, undefined);
await Promise.resolve();
assert.deepEqual(warned, {
message: 'Router did not become ready after fallback mount:',
cause: error,
});
});