Project format updates
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {createSharedFolderReader} from '../src/shared-folder.js';
|
||||
import {createSharedFolderReader, openWorkspaceAsset} from '../src/shared-folder.js';
|
||||
|
||||
test('opening a workspace asset rejects cross-group, cross-asset and overprivileged replies', async () => {
|
||||
const scope = {workspaceId: 'company', groupId: 'estimators'};
|
||||
const grant = {...scope, asset: 'suppliers', folderId: 'folder-1', path: '/shared/suppliers', canWrite: false};
|
||||
const open = reply => openWorkspaceAsset({scope, asset: 'suppliers', access: 'read', bridge: {
|
||||
async invoke(command, args) {
|
||||
assert.equal(command, 'filesystem_open_workspace_asset');
|
||||
assert.deepEqual(args, {asset: 'suppliers', access: 'read'});
|
||||
return reply;
|
||||
}
|
||||
}});
|
||||
assert.deepEqual(await open(grant), grant);
|
||||
for (const patch of [{groupId:'other'}, {asset:'prices'}, {path:'/shared'}, {canWrite:true}]) {
|
||||
await assert.rejects(open({...grant, ...patch}), /Invalid workspace asset grant/);
|
||||
}
|
||||
});
|
||||
|
||||
test('specialist and other viewers read the same existing supplier register and price book', async () => {
|
||||
const root='/Shared/Registers';
|
||||
|
||||
Reference in New Issue
Block a user