mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 18:22:41 -08:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
51
src/main/runtime/overlay-window-factory-main-deps.test.ts
Normal file
51
src/main/runtime/overlay-window-factory-main-deps.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
createBuildCreateInvisibleWindowMainDepsHandler,
|
||||
createBuildCreateMainWindowMainDepsHandler,
|
||||
createBuildCreateOverlayWindowMainDepsHandler,
|
||||
createBuildCreateSecondaryWindowMainDepsHandler,
|
||||
} from './overlay-window-factory-main-deps';
|
||||
|
||||
test('overlay window factory main deps builders return mapped handlers', () => {
|
||||
const calls: string[] = [];
|
||||
const buildOverlayDeps = createBuildCreateOverlayWindowMainDepsHandler({
|
||||
createOverlayWindowCore: (kind) => ({ kind }),
|
||||
isDev: true,
|
||||
getOverlayDebugVisualizationEnabled: () => false,
|
||||
ensureOverlayWindowLevel: () => calls.push('ensure-level'),
|
||||
onRuntimeOptionsChanged: () => calls.push('runtime-options-changed'),
|
||||
setOverlayDebugVisualizationEnabled: (enabled) => calls.push(`debug:${enabled}`),
|
||||
isOverlayVisible: (kind) => kind === 'visible',
|
||||
tryHandleOverlayShortcutLocalFallback: () => false,
|
||||
onWindowClosed: (kind) => calls.push(`closed:${kind}`),
|
||||
});
|
||||
|
||||
const overlayDeps = buildOverlayDeps();
|
||||
assert.equal(overlayDeps.isDev, true);
|
||||
assert.equal(overlayDeps.getOverlayDebugVisualizationEnabled(), false);
|
||||
assert.equal(overlayDeps.isOverlayVisible('visible'), true);
|
||||
|
||||
const buildMainDeps = createBuildCreateMainWindowMainDepsHandler({
|
||||
createOverlayWindow: () => ({ id: 'visible' }),
|
||||
setMainWindow: () => calls.push('set-main'),
|
||||
});
|
||||
const mainDeps = buildMainDeps();
|
||||
mainDeps.setMainWindow(null);
|
||||
|
||||
const buildInvisibleDeps = createBuildCreateInvisibleWindowMainDepsHandler({
|
||||
createOverlayWindow: () => ({ id: 'invisible' }),
|
||||
setInvisibleWindow: () => calls.push('set-invisible'),
|
||||
});
|
||||
const invisibleDeps = buildInvisibleDeps();
|
||||
invisibleDeps.setInvisibleWindow(null);
|
||||
|
||||
const buildSecondaryDeps = createBuildCreateSecondaryWindowMainDepsHandler({
|
||||
createOverlayWindow: () => ({ id: 'secondary' }),
|
||||
setSecondaryWindow: () => calls.push('set-secondary'),
|
||||
});
|
||||
const secondaryDeps = buildSecondaryDeps();
|
||||
secondaryDeps.setSecondaryWindow(null);
|
||||
|
||||
assert.deepEqual(calls, ['set-main', 'set-invisible', 'set-secondary']);
|
||||
});
|
||||
Reference in New Issue
Block a user