Read existing Client catalogs through verified workspace context

This commit is contained in:
khondokartowsif171
2026-10-19 01:34:52 +06:00
parent 6db99f96df
commit 165320cc9f
10 changed files with 189 additions and 17 deletions
+11
View File
@@ -144,3 +144,14 @@ test('workspace bootstrap returns canonical client identity without reading save
assert.equal(owner.status, 409);
assert.equal((await f.call('readonly', '/api/workspace')).body.workspace.canWriteProducts, false);
});
test('connected catalog remains read-only and returns same-origin image references', async t => {
const f = await setup(t, { getConnected: async ws => ({ id: 'connected:' + ws.clientId, readOnly: true, products: [{ id: 'connected-product', title: 'Source', rawPrice: 380, image: 'https://images.fixture/a.png' }] }) });
const result = await f.call('a', '/api/get-synced-stores');
assert.equal(result.body.stores[0].readOnly, true);
assert.match(result.body.stores[0].products[0].image, /^\/api\/catalog-image\?/);
assert.doesNotMatch(result.body.stores[0].products[0].image, /https:/);
const removed = await f.call('a', '/api/delete-synced-store', { storeId: result.body.stores[0].id });
assert.equal(removed.status, 403);
assert.equal(removed.body.code, 'CONNECTED_CATALOG_READ_ONLY');
});