refactor: Rename resourceExists to hasResource

The function was also moved to the smaller interface ResourceSet.
This commit is contained in:
Joachim Van Herwegen
2022-02-23 15:41:31 +01:00
parent 2ae5924dde
commit 4404fa07d9
26 changed files with 73 additions and 64 deletions

View File

@@ -726,13 +726,13 @@ describe('A DataAccessorBasedStore', (): void => {
describe('resource Exists', (): void => {
it('should return false when the resource does not exist.', async(): Promise<void> => {
const resourceID = { path: `${root}resource` };
await expect(store.resourceExists(resourceID)).resolves.toBeFalsy();
await expect(store.hasResource(resourceID)).resolves.toBeFalsy();
});
it('should return true when the resource exists.', async(): Promise<void> => {
const resourceID = { path: `${root}resource` };
accessor.data[resourceID.path] = representation;
await expect(store.resourceExists(resourceID)).resolves.toBeTruthy();
await expect(store.hasResource(resourceID)).resolves.toBeTruthy();
});
it('should rethrow any unexpected errors from validateIdentifier.', async(): Promise<void> => {
@@ -741,7 +741,7 @@ describe('A DataAccessorBasedStore', (): void => {
accessor.getMetadata = jest.fn(async(): Promise<any> => {
throw new Error('error');
});
await expect(store.resourceExists(resourceID)).rejects.toThrow('error');
await expect(store.hasResource(resourceID)).rejects.toThrow('error');
accessor.getMetadata = originalMetaData;
});
});