[arvados-workbench2] updated: 2.5.0-77-g66bb2fcb

git repository hosting git at public.arvados.org
Mon Mar 6 21:31:24 UTC 2023


Summary of changes:
 src/common/webdav.test.ts | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

       via  66bb2fcb669234cc9ab42eb19e253cbc3078c6cb (commit)
      from  199b80d7913ae588b098aa653ff0c24181a0a31a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 66bb2fcb669234cc9ab42eb19e253cbc3078c6cb
Author: Stephen Smith <stephen at curii.com>
Date:   Mon Mar 6 16:31:00 2023 -0500

    19899: Unit test webdav requests for cache-control must-revalidate
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/common/webdav.test.ts b/src/common/webdav.test.ts
index 2ab106fc..0a3b5170 100644
--- a/src/common/webdav.test.ts
+++ b/src/common/webdav.test.ts
@@ -2,7 +2,6 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { customEncodeURI } from "./url";
 import { WebDAV } from "./webdav";
 
 describe('WebDAV', () => {
@@ -14,34 +13,36 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'http://foo.com/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Authorization', 'Basic');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('allows to modify defaults after instantiation', async () => {
         const { open, load, setRequestHeader, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://foo.com/';
-        webdav.defaults.headers = { Authorization: 'Basic' };
+        const webdav = new WebDAV({ baseURL: 'http://foo.com/' }, createRequest);
+        webdav.setAuthorization('Basic');
         const promise = webdav.propfind('foo');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'http://foo.com/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Authorization', 'Basic');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('PROPFIND', async () => {
-        const { open, load, createRequest } = mockCreateRequest();
+        const { open, load, setRequestHeader, createRequest } = mockCreateRequest();
         const webdav = new WebDAV(undefined, createRequest);
         const promise = webdav.propfind('foo');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PROPFIND', 'foo');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('PUT', async () => {
-        const { open, send, load, progress, createRequest } = mockCreateRequest();
+        const { open, send, load, progress, setRequestHeader, createRequest } = mockCreateRequest();
         const webdav = new WebDAV(undefined, createRequest);
         const promise = webdav.put('foo', 'Test data');
         progress();
@@ -49,88 +50,90 @@ describe('WebDAV', () => {
         const request = await promise;
         expect(open).toHaveBeenCalledWith('PUT', 'foo');
         expect(send).toHaveBeenCalledWith('Test data');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('COPY', async () => {
         const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        const webdav = new WebDAV({ baseURL: 'http://base' }, createRequest);
         const promise = webdav.copy('foo', 'foo-copy');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('COPY - adds baseURL with trailing slash to Destination header', async () => {
         const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        const webdav = new WebDAV({ baseURL: 'http://base' }, createRequest);
         const promise = webdav.copy('foo', 'foo-copy');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('COPY - adds baseURL without trailing slash to Destination header', async () => {
         const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        const webdav = new WebDAV({ baseURL: 'http://base' }, createRequest);
         const promise = webdav.copy('foo', 'foo-copy');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('COPY', 'http://base/foo');
         expect(setRequestHeader).toHaveBeenCalledWith('Destination', 'http://base/foo-copy');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('MOVE', async () => {
         const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        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', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('MOVE - adds baseURL with trailing slash to Destination header', async () => {
         const { open, setRequestHeader, load, createRequest } = mockCreateRequest();
-        const webdav = new WebDAV(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        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', 'must-revalidate');
         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(undefined, createRequest);
-        webdav.defaults.baseURL = 'http://base';
+        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', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 
     it('DELETE', async () => {
-        const { open, load, createRequest } = mockCreateRequest();
+        const { open, load, setRequestHeader, createRequest } = mockCreateRequest();
         const webdav = new WebDAV(undefined, createRequest);
         const promise = webdav.delete('foo');
         load();
         const request = await promise;
         expect(open).toHaveBeenCalledWith('DELETE', 'foo');
+        expect(setRequestHeader).toHaveBeenCalledWith('Cache-Control', 'must-revalidate');
         expect(request).toBeInstanceOf(XMLHttpRequest);
     });
 });

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list