import { describe, expect, it } from 'vitest'; import { DEV_RELOAD_EXISTING_ARG, resolveSecondInstanceAction } from './second-instance.rules'; describe('resolveSecondInstanceAction', () => { it('reloads the open window when a dev launch asks to reuse it', () => { const action = resolveSecondInstanceAction({ argv: [ 'electron', '.', DEV_RELOAD_EXISTING_ARG ], devSingleInstanceExitCode: 23 }); expect(action).toBe('reload-existing'); }); it('never asks a packaged instance to reload, even with the dev argument', () => { const action = resolveSecondInstanceAction({ argv: ['metoyou', DEV_RELOAD_EXISTING_ARG], devSingleInstanceExitCode: null }); expect(action).toBe('focus'); }); it('focuses the open window for an ordinary second launch', () => { const action = resolveSecondInstanceAction({ argv: [ 'electron', '.', 'toju://invite/abc' ], devSingleInstanceExitCode: 23 }); expect(action).toBe('focus'); }); });