mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Add acl support
This commit is contained in:
31
test/unit/storage/UrlContainerManager.test.ts
Normal file
31
test/unit/storage/UrlContainerManager.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { UrlContainerManager } from '../../../src/storage/UrlContainerManager';
|
||||
|
||||
describe('An UrlContainerManager', (): void => {
|
||||
it('returns the parent URl for a single call.', async(): Promise<void> => {
|
||||
const manager = new UrlContainerManager('http://test.com/foo/');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo/bar' }))
|
||||
.resolves.toEqual({ path: 'http://test.com/foo/' });
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo/bar/' }))
|
||||
.resolves.toEqual({ path: 'http://test.com/foo/' });
|
||||
});
|
||||
|
||||
it('errors when getting the container of root.', async(): Promise<void> => {
|
||||
let manager = new UrlContainerManager('http://test.com/foo/');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo/' }))
|
||||
.rejects.toThrow('Root does not have a container.');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo' }))
|
||||
.rejects.toThrow('Root does not have a container.');
|
||||
|
||||
manager = new UrlContainerManager('http://test.com/foo');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo/' }))
|
||||
.rejects.toThrow('Root does not have a container.');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/foo' }))
|
||||
.rejects.toThrow('Root does not have a container.');
|
||||
});
|
||||
|
||||
it('errors when the root of an URl is reached that does not match the input root.', async(): Promise<void> => {
|
||||
const manager = new UrlContainerManager('http://test.com/foo/');
|
||||
await expect(manager.getContainer({ path: 'http://test.com/' }))
|
||||
.rejects.toThrow('URL root reached.');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user