import test from 'node:test'; import assert from 'node:assert/strict'; import { buildOverlayWindowOptions } from './overlay-window-options'; test('overlay window config explicitly disables renderer sandbox for preload compatibility', () => { const options = buildOverlayWindowOptions('visible', { isDev: false, yomitanSession: null, }); assert.equal(options.backgroundColor, '#00000000'); assert.equal(options.webPreferences?.sandbox, false); assert.equal(options.webPreferences?.backgroundThrottling, false); }); test('Windows visible overlay window config does not start as always-on-top', () => { const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, 'platform'); Object.defineProperty(process, 'platform', { configurable: true, value: 'win32', }); try { const options = buildOverlayWindowOptions('visible', { isDev: false, yomitanSession: null, }); assert.equal(options.alwaysOnTop, false); } finally { if (originalPlatformDescriptor) { Object.defineProperty(process, 'platform', originalPlatformDescriptor); } } }); test('overlay window config uses the provided Yomitan session when available', () => { const yomitanSession = { id: 'session' } as never; const withSession = buildOverlayWindowOptions('visible', { isDev: false, yomitanSession, }); const withoutSession = buildOverlayWindowOptions('visible', { isDev: false, yomitanSession: null, }); assert.equal(withSession.webPreferences?.session, yomitanSession); assert.equal(withoutSession.webPreferences?.session, undefined); });