Read legacy inbox and activity storage

This commit is contained in:
2026-06-28 03:47:58 +08:00
parent b4ef3b38b0
commit 4a1550acf6
4 changed files with 99 additions and 9 deletions
+28
View File
@@ -238,6 +238,34 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w
const persisted = await mountWithApi(persistedApi);
if (!persisted.container.textContent.includes('Saved note')) throw new Error('persisted activity was not rendered');
const legacyApi = makeApi({
events: [
{
activityId: 'legacy-global',
type: 'browser.capture.page',
title: 'Legacy global capture',
occurredAt: '2026-06-27T02:00:00Z',
sourcePluginId: 'verstak.browser-inbox',
},
{
activityId: 'legacy-project',
type: 'note.saved',
title: 'Legacy project note',
occurredAt: '2026-06-27T02:10:00Z',
sourcePluginId: 'verstak.notes',
payload: { path: 'Project/Notes/Legacy.md' },
},
],
});
const legacyGlobal = await mountWithApi(legacyApi, {});
if (!legacyGlobal.container.textContent.includes('Legacy global capture')) throw new Error('legacy global activity was not rendered in global view');
if (!legacyGlobal.container.textContent.includes('Legacy project note')) throw new Error('legacy workspace activity was not rendered in global view');
component.unmount && component.unmount(legacyGlobal.container);
const legacyProject = await mountWithApi(legacyApi, { workspaceNode: { name: 'Project' }, workspaceRootPath: 'Project' });
if (!legacyProject.container.textContent.includes('Legacy project note')) throw new Error('legacy workspace activity was not rendered in matching workspace');
if (legacyProject.container.textContent.includes('Legacy global capture')) throw new Error('legacy global activity leaked into workspace view');
console.log('activity plugin smoke passed');
})().catch((err) => {
console.error(err);
+38
View File
@@ -274,6 +274,44 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w
throw new Error('persisted capture was not rendered on mount');
}
const legacyApi = makeApi({
captures: [
{
captureId: 'legacy-global-capture',
capturedAt: '2026-06-27T02:00:00.000Z',
kind: 'page',
url: 'https://legacy.example.com/',
title: 'Legacy Global Capture',
domain: 'legacy.example.com',
},
{
captureId: 'legacy-project-capture',
capturedAt: '2026-06-27T02:10:00.000Z',
kind: 'page',
url: 'https://project.example.com/',
title: 'Legacy Project Capture',
domain: 'project.example.com',
workspaceRootPath: 'Project',
},
],
});
const legacyGlobal = await mountWithApi(legacyApi, {});
if (!walk(legacyGlobal.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'legacy-global-capture')) {
throw new Error('legacy global capture was not rendered in global view');
}
if (!walk(legacyGlobal.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'legacy-project-capture')) {
throw new Error('legacy workspace capture was not rendered in global view');
}
component.unmount && component.unmount(legacyGlobal.container);
const legacyProject = await mountWithApi(legacyApi, { workspaceNode: { name: 'Project' }, workspaceRootPath: 'Project' });
if (!walk(legacyProject.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'legacy-project-capture')) {
throw new Error('legacy workspace capture was not rendered in matching workspace');
}
if (walk(legacyProject.container, (node) => node.getAttribute && node.getAttribute('data-browser-capture-id') === 'legacy-global-capture')) {
throw new Error('legacy global capture leaked into workspace view');
}
console.log('browser inbox plugin smoke passed');
})().catch((err) => {
console.error(err);