fix(marketplace): close client review findings

This commit is contained in:
brother7 committed 2026-08-29 12:36:21 +08:00
1 parent 57962591de
commit 3df794c2e7
14 files changed
+840 -68

No files matched your search

@@ -141,6 +141,31 @@ describe('plugin Marketplace store', () => {
expect(store.getState().installations['makelore.data']).toMatchObject({ status: 'installed' });
});
it('merges same-plugin Library and device mutations in either completion order', async () => {
for (const order of ['library-then-device', 'device-then-library'] as const) {
const acquire = deferred<MarketplaceLibraryProjection>();
const install = deferred<MarketplaceInstallation>();
const store = createPluginMarketplaceStore({
acquire: vi.fn(() => acquire.promise),
install: vi.fn(() => install.promise),
});
store.getState().activateAccount('account-a');
const libraryMutation = store.getState().acquire('makelore.notes');
const deviceMutation = store.getState().install('makelore.notes');
const installed = { status: 'installed' as const, pluginId: 'makelore.notes', version: '1.0.0' };
const acquired = { library: library('Notes acquired'), installations: [] };
if (order === 'library-then-device') {
acquire.resolve(acquired); await libraryMutation;
install.resolve(installed); await deviceMutation;
} else {
install.resolve(installed); await deviceMutation;
acquire.resolve(acquired); await libraryMutation;
}
expect(store.getState().library?.items[0]?.title).toBe('Notes acquired');
expect(store.getState().installations['makelore.notes']).toMatchObject(installed);
}
});
it('calls only the selected state mutation', async () => {
const acquire = vi.fn().mockResolvedValue(projection('Acquired'));
const install = vi.fn().mockResolvedValue({ status: 'installed', pluginId: 'makelore.notes', version: '1.0.0' });