mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore: Remove assumption that DataAccessors have a root container by default
This commit is contained in:
@@ -18,6 +18,9 @@ describe('An InMemoryDataAccessor', (): void => {
|
||||
beforeEach(async(): Promise<void> => {
|
||||
accessor = new InMemoryDataAccessor(base);
|
||||
|
||||
// Create default root container
|
||||
await accessor.writeContainer({ path: `${base}` }, new RepresentationMetadata());
|
||||
|
||||
metadata = new RepresentationMetadata({ [CONTENT_TYPE]: APPLICATION_OCTET_STREAM });
|
||||
|
||||
data = guardedStreamFrom([ 'data' ]);
|
||||
|
||||
@@ -121,26 +121,6 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
]));
|
||||
});
|
||||
|
||||
it('generates resource metadata for the root container.', async(): Promise<void> => {
|
||||
metadata = await accessor.getMetadata({ path: base });
|
||||
expect(metadata.quads()).toBeRdfIsomorphic([
|
||||
quad(namedNode('this'), namedNode('a'), namedNode('triple')),
|
||||
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Container)),
|
||||
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.BasicContainer)),
|
||||
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Resource)),
|
||||
]);
|
||||
|
||||
expect(fetchTriples).toHaveBeenCalledTimes(1);
|
||||
expect(fetchTriples.mock.calls[0][0]).toBe(endpoint);
|
||||
expect(simplifyQuery(fetchTriples.mock.calls[0][1])).toBe(simplifyQuery([
|
||||
'CONSTRUCT { ?s ?p ?o. } WHERE {',
|
||||
` { GRAPH <${base}> { ?s ?p ?o. } }`,
|
||||
' UNION',
|
||||
` { GRAPH <meta:${base}> { ?s ?p ?o. } }`,
|
||||
'}',
|
||||
]));
|
||||
});
|
||||
|
||||
it('throws 404 if no metadata was found.', async(): Promise<void> => {
|
||||
// Clear triples array
|
||||
triples = [];
|
||||
|
||||
Reference in New Issue
Block a user