From 684cd0914712c4cea5cba02b54076b4ced2dc7f0 Mon Sep 17 00:00:00 2001 From: Scott Dover Date: Thu, 14 Nov 2024 15:03:55 -0500 Subject: [PATCH] chore: update test coverage Signed-off-by: Scott Dover --- .../src/connection/rest/SASContentAdapter.ts | 8 +++++ .../ContentDataProvider.test.ts | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/client/src/connection/rest/SASContentAdapter.ts b/client/src/connection/rest/SASContentAdapter.ts index b2340f92c..934a5e5a1 100644 --- a/client/src/connection/rest/SASContentAdapter.ts +++ b/client/src/connection/rest/SASContentAdapter.ts @@ -109,9 +109,17 @@ class SASContentAdapter implements ContentAdapter { } public async getChildItems(parentItem: ContentItem): Promise { + try { + const { data: result } = await this.connection.get( + await this.generatedMembersUrlForParentItem(parentItem), + ); + } catch (e) { + throw new Error(await this.generatedMembersUrlForParentItem(parentItem)); + } const { data: result } = await this.connection.get( await this.generatedMembersUrlForParentItem(parentItem), ); + if (!result.items) { return Promise.reject(); } diff --git a/client/test/components/ContentNavigator/ContentDataProvider.test.ts b/client/test/components/ContentNavigator/ContentDataProvider.test.ts index 67dd50f11..4caa8fc65 100644 --- a/client/test/components/ContentNavigator/ContentDataProvider.test.ts +++ b/client/test/components/ContentNavigator/ContentDataProvider.test.ts @@ -451,6 +451,16 @@ describe("ContentDataProvider", async function () { status: 409, }, }); + axiosInstance.get + .withArgs( + "uri://myFavorites/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: { items: [] } }); + axiosInstance.get + .withArgs( + "uri://test/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: [] }); const dataProvider = createDataProvider(); @@ -483,6 +493,16 @@ describe("ContentDataProvider", async function () { data: { ...origItem, name: "new-file.sas" }, headers: { etag: "1234", "last-modified": "5678" }, }); + axiosInstance.get + .withArgs( + "uri://myFavorites/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: { items: [] } }); + axiosInstance.get + .withArgs( + "uri://rename/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: { items: [] } }); const dataProvider = createDataProvider(); @@ -521,6 +541,16 @@ describe("ContentDataProvider", async function () { data: referencedFile, headers: { etag: "1234", "last-modified": "5678" }, }); + axiosInstance.get + .withArgs( + "uri://myFavorites/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: { items: [] } }); + axiosInstance.get + .withArgs( + "uri://test/members?limit=1000000&filter=in(contentType,'file','dataFlow','RootFolder','folder','myFolder','favoritesFolder','userFolder','userRoot','trashFolder')&sortBy=eq(contentType,'folder'):descending,name:primary:ascending,type:ascending", + ) + .resolves({ data: { items: [] } }); await dataProvider.connect("http://test.io"); const uri: Uri = await dataProvider.renameResource(