experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: stop asserting cmd-as-feature in registry + fix renamed command/text

cmd is a core renderer (lives in app/cmd/, NOT features/cmd/), so it
never appears in api.features.list nor opens a window at startup (the
panel window is created on demand). Update the tests that assumed
otherwise:

- tests/desktop/startup-events.spec.ts:
- drop hasCmd assertion in test 2 (swapped to hasGroups, a real builtin)
- test 4 verifies cmd's command registry is alive via cmd:query-commands
instead of looking up cmd in the registry
- tests/desktop/hybrid-extension.spec.ts:
- delete the devReload cmd test — devReload now strictly errors with
Feature not found cmd; no API for reloading core renderers
- tests/helpers/window-utils.ts:
- waitForExtensionsReady now gates on groups instead of cmd (latent bug
that would have timed out every consumer)

Plus two assertions broken by earlier renames:
- core.spec.ts: reload extension command became reload feature with
description Reload an installed feature by ID

+27 -38
+6 -6
tests/desktop/core.spec.ts
··· 102 102 expect(result.restartCmd?.description).toBe('Restart the application'); 103 103 }); 104 104 105 - test('reload extension command is registered', async () => { 105 + test('reload feature command is registered', async () => { 106 106 const result = await bgWindow.evaluate(async () => { 107 107 const api = (window as any).app; 108 108 109 109 return new Promise((resolve) => { 110 110 api.subscribe('cmd:query-commands-response', (msg: any) => { 111 111 const commands = msg.commands || []; 112 - const reloadCmd = commands.find((c: any) => c.name === 'reload extension'); 112 + const reloadCmd = commands.find((c: any) => c.name === 'reload feature'); 113 113 resolve({ 114 - hasReloadExtension: !!reloadCmd, 114 + hasReloadFeature: !!reloadCmd, 115 115 description: reloadCmd?.description 116 116 }); 117 117 }); 118 118 api.publish('cmd:query-commands', {}); 119 - setTimeout(() => resolve({ hasReloadExtension: false }), 2000); 119 + setTimeout(() => resolve({ hasReloadFeature: false }), 2000); 120 120 }); 121 121 }); 122 122 123 - expect(result.hasReloadExtension).toBe(true); 124 - expect(result.description).toBe('Reload an external extension by ID'); 123 + expect(result.hasReloadFeature).toBe(true); 124 + expect(result.description).toBe('Reload an installed feature by ID'); 125 125 }); 126 126 127 127 test('api.quit and api.restart functions exist', async () => {
-12
tests/desktop/hybrid-extension.spec.ts
··· 45 45 expect(reloadResult.success).toBe(true); 46 46 }); 47 47 48 - test('api.features.devReload() reports no active tiles for unloaded core renderer', async () => { 49 - // `cmd` is a core renderer — its tile window exists but isn't managed 50 - // through the feature-registry dev-reload path, so devReload either 51 - // reports no active tiles or reloads it. Either way should not error. 52 - const reloadResult = await bgWindow.evaluate(async () => { 53 - return await (window as any).app.features.devReload('cmd'); 54 - }); 55 - 56 - expect(reloadResult).toBeTruthy(); 57 - expect(reloadResult.error).toBeFalsy(); 58 - }); 59 - 60 48 test('commands work from both consolidated and external extensions', async () => { 61 49 // Wait a bit for extensions to initialize and register commands 62 50 await sleep(1000);
+16 -17
tests/desktop/startup-events.spec.ts
··· 38 38 39 39 test('feature:all-loaded event was published during startup', async () => { 40 40 // Verify that the feature:all-loaded event was published by checking features are registered. 41 + // cmd is a core renderer (lives in app/cmd, no features/cmd manifest) and does NOT 42 + // appear in the feature registry — assert against an actual builtin feature instead. 41 43 const result = await bgWindow.evaluate(async () => { 42 44 const api = (window as any).app; 43 45 ··· 46 48 const entries = extResult?.entries || []; 47 49 return { 48 50 entryCount: entries.length, 49 - hasCmd: entries.some((e: any) => e.id === 'cmd'), 50 51 hasGroups: entries.some((e: any) => e.id === 'groups'), 51 52 }; 52 53 }); 53 54 54 55 expect(result.entryCount).toBeGreaterThan(0); 55 - expect(result.hasCmd).toBe(true); 56 + expect(result.hasGroups).toBe(true); 56 57 }); 57 58 58 59 test('cmd extension loads before other extensions can register commands', async () => { ··· 87 88 expect(hasGalleryCommand).toBe(true); 88 89 }); 89 90 90 - test('cmd feature is always registered (cannot be disabled)', async () => { 91 - // cmd is required infrastructure — verify it's always in the registered feature list 92 - // and that a cmd tile window exists. 91 + test('cmd is always running (core renderer, cannot be disabled)', async () => { 92 + // cmd is required infrastructure — it's a core renderer (NOT a registry feature 93 + // and NOT a window at startup; the panel window is created on demand). Verify 94 + // the cmd registry is alive by querying for any registered command. 93 95 const result = await bgWindow.evaluate(async () => { 94 96 const api = (window as any).app; 95 - const list = await api.features.list('builtin'); 96 - const entries = list?.entries || []; 97 - const windowList = await api.window.list({ includeInternal: true }); 98 - const hasCmdWindow = windowList?.windows?.some( 99 - (w: any) => (w.url || '').includes('peek://cmd/'), 100 - ) || false; 101 - return { 102 - cmdRegistered: entries.some((e: any) => e.id === 'cmd'), 103 - hasCmdWindow, 104 - }; 97 + return new Promise((resolve) => { 98 + api.subscribe('cmd:query-commands-response', (msg: any) => { 99 + const commands = msg?.commands || []; 100 + resolve({ commandCount: commands.length }); 101 + }); 102 + api.publish('cmd:query-commands', {}); 103 + setTimeout(() => resolve({ commandCount: 0 }), 2000); 104 + }); 105 105 }); 106 106 107 - expect(result.cmdRegistered).toBe(true); 108 - expect(result.hasCmdWindow).toBe(true); 107 + expect(result.commandCount).toBeGreaterThan(0); 109 108 }); 110 109 });
+5 -3
tests/helpers/window-utils.ts
··· 245 245 const entries = result?.entries; 246 246 if (!Array.isArray(entries)) return false; 247 247 248 - // Check if critical features are registered (cmd + at least 2 others). 249 - const hasCmd = entries.some((e: { id: string }) => e.id === 'cmd'); 250 - return hasCmd && entries.length >= 3; 248 + // Check if critical features are registered. cmd is a core renderer 249 + // (no features/cmd manifest) so it doesn't appear here — gate on 250 + // `groups`, which is the canonical eager builtin tile-backed feature. 251 + const hasGroups = entries.some((e: { id: string }) => e.id === 'groups'); 252 + return hasGroups && entries.length >= 3; 251 253 }, 252 254 { timeout } 253 255 );