mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
change: Support all PUT operations, error later
This commit is contained in:
committed by
Joachim Van Herwegen
parent
4965b476c9
commit
385e1a4cdf
@@ -11,10 +11,9 @@ describe('A PutOperationHandler', (): void => {
|
||||
store.setRepresentation = jest.fn(async(): Promise<void> => {});
|
||||
});
|
||||
|
||||
it('only supports PUT operations with a body.', async(): Promise<void> => {
|
||||
await expect(handler.canHandle({ method: 'PUT' } as Operation)).rejects.toThrow(UnsupportedHttpError);
|
||||
it('only supports PUT operations.', async(): Promise<void> => {
|
||||
await expect(handler.canHandle({ method: 'GET' } as Operation)).rejects.toThrow(UnsupportedHttpError);
|
||||
await expect(handler.canHandle({ method: 'PUT', body: { dataType: 'test' }} as Operation)).resolves.toBeUndefined();
|
||||
await expect(handler.canHandle({ method: 'PUT' } as Operation)).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('sets the representation in the store and returns its identifier.', async(): Promise<void> => {
|
||||
@@ -23,4 +22,8 @@ describe('A PutOperationHandler', (): void => {
|
||||
expect(store.setRepresentation).toHaveBeenCalledTimes(1);
|
||||
expect(store.setRepresentation).toHaveBeenLastCalledWith({ path: 'url' }, { dataType: 'test' });
|
||||
});
|
||||
|
||||
it('errors when there is no body.', async(): Promise<void> => {
|
||||
await expect(handler.handle({ method: 'PUT' } as Operation)).rejects.toThrow(UnsupportedHttpError);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user