refactor: Replace getParentContainer util function with ContainerManager

This commit is contained in:
Joachim Van Herwegen
2020-12-09 14:46:41 +01:00
parent 9c080c2101
commit f0db9e501f
18 changed files with 139 additions and 136 deletions

View File

@@ -2,7 +2,6 @@ import {
decodeUriPathComponents,
encodeUriPathComponents,
ensureTrailingSlash,
getParentContainer,
toCanonicalUriPath,
} from '../../../src/util/PathUtil';
@@ -29,16 +28,4 @@ describe('PathUtil', (): void => {
expect(encodeUriPathComponents('/a%20path&/name')).toEqual('/a%2520path%26/name');
});
});
describe('#getParentContainer', (): void => {
it('returns the parent URl for a single call.', async(): Promise<void> => {
expect(getParentContainer({ path: 'http://test.com/foo/bar' })).toEqual({ path: 'http://test.com/foo/' });
expect(getParentContainer({ path: 'http://test.com/foo/bar/' })).toEqual({ path: 'http://test.com/foo/' });
});
it('errors when the root of an URl is reached that does not match the input root.', async(): Promise<void> => {
expect((): any => getParentContainer({ path: 'http://test.com/' }))
.toThrow('Resource http://test.com/ does not have a parent container');
});
});
});