fix: Remove default root container from InMemoryDataAccessor

This commit is contained in:
Joachim Van Herwegen 2021-02-11 13:48:58 +01:00
parent 6424b07fc6
commit bb65630441
3 changed files with 12 additions and 4 deletions

View File

@ -31,8 +31,7 @@ export class InMemoryDataAccessor implements DataAccessor {
const metadata = new RepresentationMetadata({ path: this.base }); const metadata = new RepresentationMetadata({ path: this.base });
metadata.addQuads(generateResourceQuads(DataFactory.namedNode(this.base), true)); metadata.addQuads(generateResourceQuads(DataFactory.namedNode(this.base), true));
const rootContainer = { entries: {}, metadata }; this.store = { entries: { }};
this.store = { entries: { '': rootContainer }};
} }
public async canHandle(): Promise<void> { public async canHandle(): Promise<void> {

View File

@ -17,6 +17,15 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
'urn:solid-server:default:variable:baseUrl': BASE, 'urn:solid-server:default:variable:baseUrl': BASE,
}, },
) as HttpHandler; ) 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<void> => { it('can add, read and delete data based on incoming requests.', async(): Promise<void> => {

View File

@ -28,9 +28,9 @@ describe('A server with the Solid WebSockets API behind a proxy', (): void => {
}); });
}); });
it('returns a 200.', async(): Promise<void> => { it('returns a 404 if no data was initialized.', async(): Promise<void> => {
const response = await fetch(serverUrl, { headers }); const response = await fetch(serverUrl, { headers });
expect(response.status).toBe(200); expect(response.status).toBe(404);
}); });
it('sets the Updates-Via header.', async(): Promise<void> => { it('sets the Updates-Via header.', async(): Promise<void> => {