chore: Remove assumption that DataAccessors have a root container by default

This commit is contained in:
Joachim Van Herwegen
2020-12-14 15:49:58 +01:00
parent 231349b30d
commit 36eed5d620
12 changed files with 86 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
import streamifyArray from 'streamify-array';
import { RootContainerInitializer } from '../../src/init/RootContainerInitializer';
import type { Representation } from '../../src/ldp/representation/Representation';
import { RepresentationMetadata } from '../../src/ldp/representation/RepresentationMetadata';
import { InMemoryDataAccessor } from '../../src/storage/accessors/InMemoryDataAccessor';
@@ -13,6 +14,7 @@ import { SingleThreadedResourceLocker } from '../../src/util/locking/SingleThrea
import { WrappedExpiringResourceLocker } from '../../src/util/locking/WrappedExpiringResourceLocker';
import { guardedStreamFrom } from '../../src/util/StreamUtil';
import { CONTENT_TYPE } from '../../src/util/UriConstants';
import { BASE } from '../configs/Util';
describe('A LockingResourceStore', (): void => {
let path: string;
@@ -28,6 +30,10 @@ describe('A LockingResourceStore', (): void => {
path = `${base}path`;
source = new DataAccessorBasedStore(new InMemoryDataAccessor(base), new SingleRootIdentifierStrategy(base));
// Initialize store
const initializer = new RootContainerInitializer(BASE, source);
await initializer.handleSafe();
locker = new SingleThreadedResourceLocker();
expiringLocker = new WrappedExpiringResourceLocker(locker, 1000);