- expect(open).toHaveBeenCalledWith('MOVE', 'base/foo');
- expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'base/foo-moved');
+ expect(open).toHaveBeenCalledWith('MOVE', 'http://base/foo');
+ expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-moved');
+ expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');
+ expect(request).toBeInstanceOf(XMLHttpRequest);
+ });
+
+ it('MOVE - adds baseURL without trailing slash to Destination header', async () => {
+ const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
+ const webdav = new WebDAV({ baseURL: 'http://base' }, createRequest);
+ const promise = webdav.move('foo', 'foo-moved');
+ load();
+ const request = await promise;
+ expect(open).toHaveBeenCalledWith('MOVE', 'http://base/foo');
+ expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-moved');
+ expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'no-cache');