test(plugins): verify retained details across profile invalidation

This commit is contained in:
creatixchu committed 2026-10-20 20:17:53 +08:00
1 parent beae0efd91
commit c8db8fa7eb
3 files changed
+7 -4

No files matched your search

@@ -215,15 +215,16 @@ describe('ui-plugin-manager browser plugin', () => {
face.ensure()
await vi.waitFor(() => { expect(face.hooks.pluginManager.getSnapshot().status).toBe('ready') })
expect(b.list).toHaveBeenCalledTimes(1)
// Bundle detail reads go to the Host by name; a profile change forgets them.
// A profile change invalidates reads without withdrawing the displayed document.
face.loadDetail('dsh-a', '1.0.0', 'en', false)
await vi.waitFor(() => { expect(face.hooks.bundleDetails.getSnapshot()).not.toEqual({}) })
await vi.waitFor(() => { expect(Object.values(face.hooks.bundleDetails.getSnapshot())[0]?.status).toBe('ready') })
const loadedDetails = face.hooks.bundleDetails.getSnapshot()
face.retryDetail('dsh-a', '1.0.0', 'en', false)
expect(face.detailImage('dsh-a', 'README.md', 'a.png', false)).toContain('api/plugin-manager/detail-file?bundle=dsh-a')
expect(face.hooks.locale.getSnapshot().active).toBe('zh')
b.remote.emit('plugin-manager/changed', [{ reason: 'bundle' }])
await vi.waitFor(() => { expect(b.list).toHaveBeenCalledTimes(2) })
expect(face.hooks.bundleDetails.getSnapshot()).toEqual({})
expect(face.hooks.bundleDetails.getSnapshot()).toEqual(loadedDetails)
b.ctx.emit('connection/reset')
await vi.waitFor(() => { expect(b.list).toHaveBeenCalledTimes(3) })
@@ -239,6 +240,7 @@ describe('ui-plugin-manager browser plugin', () => {
await fiber.dispose()
expect(b.ctx.get('pluginNavigation')).toBeUndefined()
expect(b.ctx.get('pluginChanges')).toBeUndefined()
expect(b.slots.entries('main')).toHaveLength(0)
expect(b.slots.entries('shell.overlay')).toHaveLength(0)
expect(b.slots.entries('sidebar.panellist')).toHaveLength(0)
@@ -502,7 +502,7 @@ describe('PluginManagerPage', () => {
expect(document.querySelector('[data-detail-document]')).toBeNull()
// A read the controller forgot, after a profile change, starts again.
b.setDetails({})
expect(b.actions.loadDetail).toHaveBeenCalledTimes(2)
expect(b.actions.loadDetail).toHaveBeenLastCalledWith('dsh-better-sidebar', '0.16.0', 'en', false)
})
it('says where a bundle comes from: the spec that installs it, or built in, with its version', () => {
@@ -207,6 +207,7 @@ it('resumes queries when a management operation settles without a mounted permis
expect(actions.hooks.cuaPermissions.getSnapshot().changing).toBe(true)
actions.refresh()
f.ctx.emit('connection/reset')
await setImmediate()
expect(f.status).not.toHaveBeenCalled()
f.changes.set(false)
await vi.waitFor(() => { expect(actions.hooks.cuaPermissions.getSnapshot().busy).toBe(false) })