mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
change: Make RepresentationMetadata accept a ResourceIdentifier.
Closes https://github.com/solid/community-server/issues/388
This commit is contained in:
committed by
Joachim Van Herwegen
parent
6ee56a6d67
commit
accfc2e58d
@@ -152,7 +152,7 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
it('overwrites the metadata when writing a container and updates parent.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata('http://test.com/container/',
|
||||
metadata = new RepresentationMetadata({ path: 'http://test.com/container/' },
|
||||
{ [RDF.type]: [ toNamedNode(LDP.Resource), toNamedNode(LDP.Container) ]});
|
||||
await expect(accessor.writeContainer({ path: 'http://test.com/container/' }, metadata)).resolves.toBeUndefined();
|
||||
|
||||
@@ -171,7 +171,7 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
it('overwrites the data and metadata when writing a resource and updates parent.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata('http://test.com/container/resource',
|
||||
metadata = new RepresentationMetadata({ path: 'http://test.com/container/resource' },
|
||||
{ [RDF.type]: [ toNamedNode(LDP.Resource) ]});
|
||||
await expect(accessor.writeDocument({ path: 'http://test.com/container/resource' }, data, metadata))
|
||||
.resolves.toBeUndefined();
|
||||
@@ -190,7 +190,7 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
it('overwrites the data and metadata when writing an empty resource.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata('http://test.com/container/resource',
|
||||
metadata = new RepresentationMetadata({ path: 'http://test.com/container/resource' },
|
||||
{ [RDF.type]: [ toNamedNode(LDP.Resource) ]});
|
||||
const empty = guardedStreamFrom([]);
|
||||
await expect(accessor.writeDocument({ path: 'http://test.com/container/resource' }, empty, metadata))
|
||||
@@ -209,7 +209,7 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
it('removes all references when deleting a resource.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata('http://test.com/container/',
|
||||
metadata = new RepresentationMetadata({ path: 'http://test.com/container/' },
|
||||
{ [RDF.type]: [ toNamedNode(LDP.Resource), toNamedNode(LDP.Container) ]});
|
||||
await expect(accessor.deleteResource({ path: 'http://test.com/container/' })).resolves.toBeUndefined();
|
||||
|
||||
@@ -246,14 +246,14 @@ describe('A SparqlDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
it('errors when the SPARQL endpoint fails during writing.', async(): Promise<void> => {
|
||||
const path = 'http://test.com/container/';
|
||||
metadata = new RepresentationMetadata(path);
|
||||
const identifier = { path: 'http://test.com/container/' };
|
||||
metadata = new RepresentationMetadata(identifier);
|
||||
|
||||
updateError = 'error';
|
||||
await expect(accessor.writeContainer({ path }, metadata)).rejects.toBe(updateError);
|
||||
await expect(accessor.writeContainer(identifier, metadata)).rejects.toBe(updateError);
|
||||
|
||||
updateError = new Error();
|
||||
await expect(accessor.writeContainer({ path }, metadata)).rejects.toThrow(updateError);
|
||||
await expect(accessor.writeContainer(identifier, metadata)).rejects.toThrow(updateError);
|
||||
|
||||
updateError = undefined;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user