From 626b3114f413af2eb87c00c880ed86dc7569bb08 Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Wed, 14 Oct 2020 14:24:12 +0200 Subject: [PATCH] refactor: Rename instances of data resource to document --- src/storage/DataAccessorBasedStore.ts | 2 +- test/unit/storage/accessors/FileDataAccessor.test.ts | 4 ++-- test/unit/storage/accessors/InMemoryDataAccessor.test.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/storage/DataAccessorBasedStore.ts b/src/storage/DataAccessorBasedStore.ts index d8b84c73c..1239886aa 100644 --- a/src/storage/DataAccessorBasedStore.ts +++ b/src/storage/DataAccessorBasedStore.ts @@ -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 { diff --git a/test/unit/storage/accessors/FileDataAccessor.test.ts b/test/unit/storage/accessors/FileDataAccessor.test.ts index 30929406e..be0eb5a32 100644 --- a/test/unit/storage/accessors/FileDataAccessor.test.ts +++ b/test/unit/storage/accessors/FileDataAccessor.test.ts @@ -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 => { 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 => { + it('deletes the corresponding file for document.', async(): Promise => { cache.data = { resource: 'apple' }; await expect(accessor.deleteResource({ path: `${base}resource` })).resolves.toBeUndefined(); expect(cache.data.resource).toBeUndefined(); diff --git a/test/unit/storage/accessors/InMemoryDataAccessor.test.ts b/test/unit/storage/accessors/InMemoryDataAccessor.test.ts index 01fb8b76f..4c9cae3db 100644 --- a/test/unit/storage/accessors/InMemoryDataAccessor.test.ts +++ b/test/unit/storage/accessors/InMemoryDataAccessor.test.ts @@ -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 => { + it('throws a 404 if the identifier does not match an existing document.', async(): Promise => { 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 => { + it('throws an error if part of the path matches a document.', async(): Promise => { 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 => { + it('throws a 404 if the identifier does not match an existing document.', async(): Promise => { 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 => { + it('adds stored metadata when requesting document metadata.', async(): Promise => { 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` });