mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 18:22:42 -08:00
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import {
|
|
createRefreshOverlayShortcutsHandler,
|
|
createRegisterOverlayShortcutsHandler,
|
|
createSyncOverlayShortcutsHandler,
|
|
createUnregisterOverlayShortcutsHandler,
|
|
} from './overlay-shortcuts-lifecycle';
|
|
|
|
function createRuntime(calls: string[]) {
|
|
return {
|
|
registerOverlayShortcuts: () => calls.push('register'),
|
|
unregisterOverlayShortcuts: () => calls.push('unregister'),
|
|
syncOverlayShortcuts: () => calls.push('sync'),
|
|
refreshOverlayShortcuts: () => calls.push('refresh'),
|
|
};
|
|
}
|
|
|
|
test('register overlay shortcuts handler delegates to runtime', () => {
|
|
const calls: string[] = [];
|
|
createRegisterOverlayShortcutsHandler({
|
|
overlayShortcutsRuntime: createRuntime(calls),
|
|
})();
|
|
assert.deepEqual(calls, ['register']);
|
|
});
|
|
|
|
test('unregister overlay shortcuts handler delegates to runtime', () => {
|
|
const calls: string[] = [];
|
|
createUnregisterOverlayShortcutsHandler({
|
|
overlayShortcutsRuntime: createRuntime(calls),
|
|
})();
|
|
assert.deepEqual(calls, ['unregister']);
|
|
});
|
|
|
|
test('sync overlay shortcuts handler delegates to runtime', () => {
|
|
const calls: string[] = [];
|
|
createSyncOverlayShortcutsHandler({
|
|
overlayShortcutsRuntime: createRuntime(calls),
|
|
})();
|
|
assert.deepEqual(calls, ['sync']);
|
|
});
|
|
|
|
test('refresh overlay shortcuts handler delegates to runtime', () => {
|
|
const calls: string[] = [];
|
|
createRefreshOverlayShortcutsHandler({
|
|
overlayShortcutsRuntime: createRuntime(calls),
|
|
})();
|
|
assert.deepEqual(calls, ['refresh']);
|
|
});
|