[arvados] updated: 2.7.0-6605-geb277a8dcf

git repository hosting git at public.arvados.org
Mon May 20 15:33:35 UTC 2024


Summary of changes:
 .../api-client-authorization-service.test.ts       | 10 ++++-----
 .../collection-service/collection-service.test.ts  | 26 +++++++++++-----------
 .../common-service/common-resource-service.test.ts |  6 ++---
 .../project-service/project-service.test.ts        |  6 ++---
 4 files changed, 24 insertions(+), 24 deletions(-)

       via  eb277a8dcfd0c5c4c7a06ae2c2a45effb6dcaeee (commit)
      from  9ee659acc7d530e30d131583559c28ba615717f6 (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 eb277a8dcfd0c5c4c7a06ae2c2a45effb6dcaeee
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon May 20 11:33:29 2024 -0400

    21720: added type assertions for AxiosInstance post
    
    Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/services/api-client-authorization-service/api-client-authorization-service.test.ts b/services/workbench2/src/services/api-client-authorization-service/api-client-authorization-service.test.ts
index 4dd01b8737..127ad4e998 100644
--- a/services/workbench2/src/services/api-client-authorization-service/api-client-authorization-service.test.ts
+++ b/services/workbench2/src/services/api-client-authorization-service/api-client-authorization-service.test.ts
@@ -21,15 +21,15 @@ describe('ApiClientAuthorizationService', () => {
 
     describe('createCollectionSharingToken', () => {
         it('should return error on invalid collection uuid', () => {
-            expect(() => apiClientAuthorizationService.createCollectionSharingToken("foo")).toThrowError("UUID foo is not a collection");
+            expect(() => apiClientAuthorizationService.createCollectionSharingToken("foo", undefined)).toThrowError("UUID foo is not a collection");
         });
 
         it('should make a create request with proper scopes and no expiration date', async () => {
             serverApi.post = jest.fn(() => Promise.resolve(
                 { data: { uuid: 'zzzzz-4zz18-0123456789abcde' } }
-            ));
+            )) as AxiosInstance['post'];
             const uuid = 'zzzzz-4zz18-0123456789abcde'
-            await apiClientAuthorizationService.createCollectionSharingToken(uuid);
+            await apiClientAuthorizationService.createCollectionSharingToken(uuid, undefined);
             expect(serverApi.post).toHaveBeenCalledWith(
                 '/api_client_authorizations', {
                     scopes: [
@@ -44,7 +44,7 @@ describe('ApiClientAuthorizationService', () => {
         it('should make a create request with proper scopes and expiration date', async () => {
             serverApi.post = jest.fn(() => Promise.resolve(
                 { data: { uuid: 'zzzzz-4zz18-0123456789abcde' } }
-            ));
+            ))  as AxiosInstance['post'];
             const uuid = 'zzzzz-4zz18-0123456789abcde'
             const expDate = new Date(2022, 8, 28, 12, 0, 0);
             await apiClientAuthorizationService.createCollectionSharingToken(uuid, expDate);
@@ -69,7 +69,7 @@ describe('ApiClientAuthorizationService', () => {
         it('should make a list request with proper scopes', async () => {
             serverApi.get = jest.fn(() => Promise.resolve(
                 { data: { items: [{}] } }
-            ));
+            ))  as AxiosInstance['post'];
             const uuid = 'zzzzz-4zz18-0123456789abcde'
             await apiClientAuthorizationService.listCollectionSharingTokens(uuid);
             expect(serverApi.get).toHaveBeenCalledWith(
diff --git a/services/workbench2/src/services/collection-service/collection-service.test.ts b/services/workbench2/src/services/collection-service/collection-service.test.ts
index 3b4f423a0f..1e368c4885 100644
--- a/services/workbench2/src/services/collection-service/collection-service.test.ts
+++ b/services/workbench2/src/services/collection-service/collection-service.test.ts
@@ -38,7 +38,7 @@ describe('collection-service', () => {
         it('should make a request with default selected fields', async () => {
             serverApi.get = jest.fn(() => Promise.resolve(
                 { data: { items: [{}] } }
-            ));
+            )) as AxiosInstance['post'];
             const uuid = 'zzzzz-4zz18-0123456789abcde'
             await collectionService.get(uuid);
             expect(serverApi.get).toHaveBeenCalledWith(
@@ -53,7 +53,7 @@ describe('collection-service', () => {
         it('should be able to request specific fields', async () => {
             serverApi.get = jest.fn(() => Promise.resolve(
                 { data: { items: [{}] } }
-            ));
+            )) as AxiosInstance['post'];
             const uuid = 'zzzzz-4zz18-0123456789abcde'
             await collectionService.get(uuid, undefined, ['manifestText']);
             expect(serverApi.get).toHaveBeenCalledWith(
@@ -68,7 +68,7 @@ describe('collection-service', () => {
 
     describe('update', () => {
         it('should call put selecting updated fields + others', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const data: Partial<CollectionResource> = {
                 name: 'foo',
             };
@@ -129,7 +129,7 @@ describe('collection-service', () => {
     describe('deleteFiles', () => {
         it('should remove no files', async () => {
             // given
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const filePaths: string[] = [];
             const collectionUUID = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
 
@@ -150,7 +150,7 @@ describe('collection-service', () => {
 
         it('should remove only root files', async () => {
             // given
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const filePaths: string[] = ['/root/1', '/root/1/100', '/root/1/100/test.txt', '/root/2', '/root/2/200', '/root/3/300/test.txt'];
             const collectionUUID = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
 
@@ -174,7 +174,7 @@ describe('collection-service', () => {
         });
 
         it('should batch remove files', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             // given
             const filePaths: string[] = ['/root/1', '/secondFile', 'barefile.txt'];
             const collectionUUID = 'zzzzz-4zz18-5o5tg0l9a57gxxx';
@@ -201,7 +201,7 @@ describe('collection-service', () => {
 
     describe('renameFile', () => {
         it('should rename file', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const collectionUuid = 'zzzzz-4zz18-ywq0rvhwwhkjnfq';
             const collectionPdh = '8cd9ce1dfa21c635b620b1bfee7aaa08+180';
             const oldPath = '/old/path';
@@ -226,7 +226,7 @@ describe('collection-service', () => {
 
     describe('copyFiles', () => {
         it('should batch copy files', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const filePaths: string[] = ['/root/1', '/secondFile', 'barefile.txt'];
             const sourcePdh = '8cd9ce1dfa21c635b620b1bfee7aaa08+180';
 
@@ -254,7 +254,7 @@ describe('collection-service', () => {
 
         it('should copy files from rooth', async () => {
             // Test copying from root paths
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const filePaths: string[] = ['/'];
             const sourcePdh = '8cd9ce1dfa21c635b620b1bfee7aaa08+180';
 
@@ -278,7 +278,7 @@ describe('collection-service', () => {
 
         it('should copy files to root path', async () => {
             // Test copying to root paths
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             const filePaths: string[] = ['/'];
             const sourcePdh = '8cd9ce1dfa21c635b620b1bfee7aaa08+180';
 
@@ -303,7 +303,7 @@ describe('collection-service', () => {
 
     describe('moveFiles', () => {
         it('should batch move files', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             // given
             const filePaths: string[] = ['/rootFile', '/secondFile', '/subpath/subfile', 'barefile.txt'];
             const srcCollectionUUID = 'zzzzz-4zz18-5o5tg0l9a57gxxx';
@@ -348,7 +348,7 @@ describe('collection-service', () => {
         });
 
         it('should batch move files within collection', async () => {
-            serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+            serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
             // given
             const filePaths: string[] = ['/one', '/two', '/subpath/subfile', 'barefile.txt'];
             const srcCollectionUUID = 'zzzzz-4zz18-5o5tg0l9a57gxxx';
@@ -433,7 +433,7 @@ describe('collection-service', () => {
             const collectionUuid = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
 
             for (var i = 0; i < directoryNames.length; i++) {
-                serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
+                serverApi.put = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
                 // when
                 await collectionService.createDirectory(collectionUuid, directoryNames[i].in);
                 // then
diff --git a/services/workbench2/src/services/common-service/common-resource-service.test.ts b/services/workbench2/src/services/common-service/common-resource-service.test.ts
index 7f47f20ef7..913823e289 100644
--- a/services/workbench2/src/services/common-service/common-resource-service.test.ts
+++ b/services/workbench2/src/services/common-service/common-resource-service.test.ts
@@ -41,14 +41,14 @@ describe("CommonResourceService", () => {
     });
 
     it("#create maps request params to snake case", async () => {
-        axiosInstance.post = jest.fn(() => Promise.resolve({data: {}}));
+        axiosInstance.post = jest.fn(() => Promise.resolve({data: {}})) as AxiosInstance['post'];
         const commonResourceService = new CommonResourceService(axiosInstance, "resources", actions);
         await commonResourceService.create({ ownerUuid: "ownerUuidValue" });
         expect(axiosInstance.post).toHaveBeenCalledWith("/resources", {resource: {owner_uuid: "ownerUuidValue"}});
     });
 
     it("#create ignores fields listed as readonly", async () => {
-        axiosInstance.post = jest.fn(() => Promise.resolve({data: {}}));
+        axiosInstance.post = jest.fn(() => Promise.resolve({data: {}})) as AxiosInstance['post'];
         const commonResourceService = new CommonResourceService(axiosInstance, "resources", actions);
         // UUID fields are read-only on all resources.
         await commonResourceService.create({ uuid: "this should be ignored", ownerUuid: "ownerUuidValue" });
@@ -56,7 +56,7 @@ describe("CommonResourceService", () => {
     });
 
     it("#update ignores fields listed as readonly", async () => {
-        axiosInstance.put = jest.fn(() => Promise.resolve({data: {}}));
+        axiosInstance.put = jest.fn(() => Promise.resolve({data: {}})) as AxiosInstance['post'];
         const commonResourceService = new CommonResourceService(axiosInstance, "resources", actions);
         // UUID fields are read-only on all resources.
         await commonResourceService.update('resource-uuid', { uuid: "this should be ignored", ownerUuid: "ownerUuidValue" });
diff --git a/services/workbench2/src/services/project-service/project-service.test.ts b/services/workbench2/src/services/project-service/project-service.test.ts
index 760ae85e07..067e3e66c2 100644
--- a/services/workbench2/src/services/project-service/project-service.test.ts
+++ b/services/workbench2/src/services/project-service/project-service.test.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import axios from "axios";
+import axios, { AxiosInstance } from "axios";
 import { ProjectService } from "./project-service";
 import { FilterBuilder } from "services/api/filter-builder";
 import { ApiActions } from "services/api/api-actions";
@@ -15,7 +15,7 @@ describe("CommonResourceService", () => {
     };
 
     it(`#create has groupClass set to "project"`, async () => {
-        axiosInstance.post = jest.fn(() => Promise.resolve({ data: {} }));
+        axiosInstance.post = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
         const projectService = new ProjectService(axiosInstance, actions);
         const resource = await projectService.create({ name: "nameValue" });
         expect(axiosInstance.post).toHaveBeenCalledWith("/groups", {
@@ -27,7 +27,7 @@ describe("CommonResourceService", () => {
     });
 
     it("#list has groupClass filter set by default", async () => {
-        axiosInstance.get = jest.fn(() => Promise.resolve({ data: {} }));
+        axiosInstance.get = jest.fn(() => Promise.resolve({ data: {} })) as AxiosInstance['post'];
         const projectService = new ProjectService(axiosInstance, actions);
         const resource = await projectService.list();
         expect(axiosInstance.get).toHaveBeenCalledWith("/groups", {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list