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

@@ -17,7 +17,7 @@ describe('A RoutingResourceStore', (): void => {
setRepresentation: jest.fn(),
modifyResource: jest.fn(),
deleteResource: jest.fn(),
resourceExists: jest.fn(),
hasResource: jest.fn(),
};
rule = new StaticAsyncHandler(true, source);
@@ -60,10 +60,10 @@ describe('A RoutingResourceStore', (): void => {
expect(source.deleteResource).toHaveBeenLastCalledWith(identifier, 'conditions');
});
it('calls resourceExists on the resulting store.', async(): Promise<void> => {
await expect(store.resourceExists(identifier)).resolves.toBeUndefined();
expect(source.resourceExists).toHaveBeenCalledTimes(1);
expect(source.resourceExists).toHaveBeenLastCalledWith(identifier, undefined);
it('calls hasResource on the resulting store.', async(): Promise<void> => {
await expect(store.hasResource(identifier)).resolves.toBeUndefined();
expect(source.hasResource).toHaveBeenCalledTimes(1);
expect(source.hasResource).toHaveBeenLastCalledWith(identifier);
});
it('throws a 404 if there is no body and no store was found.', async(): Promise<void> => {