mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Rename instances of data resource to document
This commit is contained in:
parent
b896004bac
commit
626b3114f4
@ -339,7 +339,7 @@ export class DataAccessorBasedStore implements ResourceStore {
|
||||
|
||||
/**
|
||||
* Create containers starting from the root until the given identifier corresponds to an existing container.
|
||||
* Will throw errors if the identifier of the last existing "container" corresponds to an existing data resource.
|
||||
* Will throw errors if the identifier of the last existing "container" corresponds to an existing document.
|
||||
* @param container - Identifier of the container which will need to exist.
|
||||
*/
|
||||
protected async createRecursiveContainers(container: ResourceIdentifier): Promise<void> {
|
||||
|
@ -140,7 +140,7 @@ describe('A FileDataAccessor', (): void => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('writing a data resource', (): void => {
|
||||
describe('writing a document', (): void => {
|
||||
it('throws a 404 if the identifier does not start with the base.', async(): Promise<void> => {
|
||||
await expect(accessor.writeDocument({ path: 'badpath' }, streamifyArray([]), metadata))
|
||||
.rejects.toThrow(NotFoundHttpError);
|
||||
@ -262,7 +262,7 @@ describe('A FileDataAccessor', (): void => {
|
||||
await expect(accessor.deleteResource({ path: `${base}container` })).rejects.toThrow(NotFoundHttpError);
|
||||
});
|
||||
|
||||
it('deletes the corresponding file for data resources.', async(): Promise<void> => {
|
||||
it('deletes the corresponding file for document.', async(): Promise<void> => {
|
||||
cache.data = { resource: 'apple' };
|
||||
await expect(accessor.deleteResource({ path: `${base}resource` })).resolves.toBeUndefined();
|
||||
expect(cache.data.resource).toBeUndefined();
|
||||
|
@ -27,7 +27,7 @@ describe('An InMemoryDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
describe('reading and writing data', (): void => {
|
||||
it('throws a 404 if the identifier does not match an existing data resource.', async(): Promise<void> => {
|
||||
it('throws a 404 if the identifier does not match an existing document.', async(): Promise<void> => {
|
||||
await expect(accessor.getData({ path: `${base}resource` })).rejects.toThrow(NotFoundHttpError);
|
||||
await expect(accessor.getData({ path: `${base}container/resource` })).rejects.toThrow(NotFoundHttpError);
|
||||
});
|
||||
@ -36,7 +36,7 @@ describe('An InMemoryDataAccessor', (): void => {
|
||||
await expect(accessor.getData({ path: base })).rejects.toThrow(NotFoundHttpError);
|
||||
});
|
||||
|
||||
it('throws an error if part of the path matches a data resource.', async(): Promise<void> => {
|
||||
it('throws an error if part of the path matches a document.', async(): Promise<void> => {
|
||||
await accessor.writeDocument({ path: `${base}resource` }, streamifyArray([ 'data' ]), metadata);
|
||||
await expect(accessor.getData({ path: `${base}resource/resource2` })).rejects.toThrow(new Error('Invalid path.'));
|
||||
});
|
||||
@ -52,7 +52,7 @@ describe('An InMemoryDataAccessor', (): void => {
|
||||
});
|
||||
|
||||
describe('reading and writing metadata', (): void => {
|
||||
it('throws a 404 if the identifier does not match an existing data resource.', async(): Promise<void> => {
|
||||
it('throws a 404 if the identifier does not match an existing document.', async(): Promise<void> => {
|
||||
await expect(accessor.getMetadata({ path: `${base}resource` })).rejects.toThrow(NotFoundHttpError);
|
||||
});
|
||||
|
||||
@ -85,7 +85,7 @@ describe('An InMemoryDataAccessor', (): void => {
|
||||
);
|
||||
});
|
||||
|
||||
it('adds stored metadata when requesting data resource metadata.', async(): Promise<void> => {
|
||||
it('adds stored metadata when requesting document metadata.', async(): Promise<void> => {
|
||||
const inputMetadata = new RepresentationMetadata(`${base}resource`, { [RDF.type]: toNamedNode(LDP.Resource) });
|
||||
await accessor.writeDocument({ path: `${base}resource` }, streamifyArray([ 'data' ]), inputMetadata);
|
||||
metadata = await accessor.getMetadata({ path: `${base}resource` });
|
||||
|
Loading…
x
Reference in New Issue
Block a user