feat: add plugin marketplace renderer
This commit is contained in:
1 parent
8b6824a8ba
commit
97c9ad1aad
27 files changed
+1585
-23
No files matched your search
@@ -46,6 +46,22 @@ async function invoke(ctx: HostApiContext, method: string, target: string, body?
|
||||
}
|
||||
|
||||
describe('Main-owned plugin Marketplace routes', () => {
|
||||
it('returns the joined Library/install projection without device or account authority', async () => {
|
||||
const projection = {
|
||||
library: { items: [], total: 0, stale: false, fetchedAt: 1 },
|
||||
installations: [{ status: 'installed', pluginId: 'notes', releaseId: 'release-1', version: '1.0.0' }],
|
||||
};
|
||||
const readLibrary = vi.fn().mockResolvedValue(projection);
|
||||
const ctx = { codingProducts: { pluginMarketplace: {
|
||||
readLibrary, readCatalog: vi.fn(), readDetail: vi.fn(), acquire: vi.fn(), remove: vi.fn(),
|
||||
install: vi.fn(), update: vi.fn(), uninstall: vi.fn(),
|
||||
} } } as unknown as HostApiContext;
|
||||
|
||||
const result = await invoke(ctx, 'GET', '/api/coding/plugin-marketplace/library');
|
||||
expect(result).toMatchObject({ handled: true, status: 200, payload: projection });
|
||||
expect(JSON.stringify(result.payload)).not.toMatch(/path|hash|token|account|admission|definition/i);
|
||||
});
|
||||
|
||||
it('forwards only bounded catalog query fields and detail IDs', async () => {
|
||||
const catalog = vi.fn().mockResolvedValue({ items: [], total: 0 });
|
||||
const detail = vi.fn().mockResolvedValue({ pluginId: 'notes' });
|
||||
|
||||
Reference in new issue
Block a user