Read existing Client catalogs through verified workspace context
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user