From bb6563044190b521d7d06ad3af0e5e3c482907af Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Thu, 11 Feb 2021 13:48:58 +0100 Subject: [PATCH] fix: Remove default root container from InMemoryDataAccessor --- src/storage/accessors/InMemoryDataAccessor.ts | 3 +-- test/integration/LpdHandlerOperations.test.ts | 9 +++++++++ test/integration/WebSocketsProtocol.test.ts | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/storage/accessors/InMemoryDataAccessor.ts b/src/storage/accessors/InMemoryDataAccessor.ts index cb5c479f4a..1938cb430b 100644 --- a/src/storage/accessors/InMemoryDataAccessor.ts +++ b/src/storage/accessors/InMemoryDataAccessor.ts @@ -31,8 +31,7 @@ export class InMemoryDataAccessor implements DataAccessor { const metadata = new RepresentationMetadata({ path: this.base }); metadata.addQuads(generateResourceQuads(DataFactory.namedNode(this.base), true)); - const rootContainer = { entries: {}, metadata }; - this.store = { entries: { '': rootContainer }}; + this.store = { entries: { }}; } public async canHandle(): Promise { diff --git a/test/integration/LpdHandlerOperations.test.ts b/test/integration/LpdHandlerOperations.test.ts index c4254d952a..185d1ccd27 100644 --- a/test/integration/LpdHandlerOperations.test.ts +++ b/test/integration/LpdHandlerOperations.test.ts @@ -17,6 +17,15 @@ describe('An integrated AuthenticatedLdpHandler', (): void => { 'urn:solid-server:default:variable:baseUrl': BASE, }, ) as HttpHandler; + + // The tests depend on there being a root container here + await performRequest( + handler, + new URL('http://test.com/'), + 'PUT', + { 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' }, + [ ], + ); }); it('can add, read and delete data based on incoming requests.', async(): Promise => { diff --git a/test/integration/WebSocketsProtocol.test.ts b/test/integration/WebSocketsProtocol.test.ts index afb97c7fb8..f437a80471 100644 --- a/test/integration/WebSocketsProtocol.test.ts +++ b/test/integration/WebSocketsProtocol.test.ts @@ -28,9 +28,9 @@ describe('A server with the Solid WebSockets API behind a proxy', (): void => { }); }); - it('returns a 200.', async(): Promise => { + it('returns a 404 if no data was initialized.', async(): Promise => { const response = await fetch(serverUrl, { headers }); - expect(response.status).toBe(200); + expect(response.status).toBe(404); }); it('sets the Updates-Via header.', async(): Promise => {