diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index ed0f671c7..b8bec30da 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -56,8 +56,6 @@ import { mockGetManyPublishItemInformations, mockGetMember, mockGetMemberMentions, - mockGetMembers, - mockGetMembersBy, mockGetMembershipRequestsForItem, mockGetOwnMembershipRequests, mockGetOwnRecycledItemData, @@ -122,7 +120,6 @@ Cypress.Commands.add( getItemError = false, editItemError = false, shareItemError = false, - getMemberError = false, defaultUploadError = false, defaultDownloadFileError = false, getCurrentMemberError = false, @@ -210,10 +207,6 @@ Cypress.Commands.add( mockGetMember(cachedMembers); - mockGetMembers(cachedMembers); - - mockGetMembersBy(cachedMembers, getMemberError); - mockUploadItem(cachedItems, defaultUploadError); mockDefaultDownloadFile(cachedItems, defaultDownloadFileError); diff --git a/cypress/support/server.ts b/cypress/support/server.ts index c0dda9a3d..e79c55838 100644 --- a/cypress/support/server.ts +++ b/cypress/support/server.ts @@ -24,7 +24,6 @@ import { getIdsFromPath, isRootItem, } from '@graasp/sdk'; -import { FAILURE_MESSAGES } from '@graasp/translations'; import { StatusCodes } from 'http-status-codes'; import { v4 as uuidv4, v4 } from 'uuid'; @@ -78,7 +77,6 @@ const { buildClearItemChatRoute, buildDeleteItemVisibilityRoute, buildDeleteItemsRoute, - buildGetMembersByIdRoute, buildUploadItemThumbnailRoute, buildUploadAvatarRoute, buildImportZipRoute, @@ -675,80 +673,6 @@ export const mockGetMember = (members: Member[]): void => { ).as('getMember'); }; -export const mockGetMembers = (members: Member[]): void => { - cy.intercept( - { - method: HttpMethod.Get, - url: `${API_HOST}/${buildGetMembersByIdRoute([''])}*`, - }, - ({ url, reply }) => { - const memberIds = new URL(url).searchParams.getAll('id'); - - const result: { - data: { [key: string]: Member }; - errors: { statusCode: number; name: string }[]; - } = { - data: {}, - errors: [], - }; - - memberIds?.forEach((id) => { - const m = getMemberById(members, id); - if (!m) { - result.errors.push({ - statusCode: StatusCodes.NOT_FOUND, - name: FAILURE_MESSAGES.MEMBER_NOT_FOUND, - }); - } else { - result.data[m.id] = m; - } - }); - - return reply({ - body: result, - statusCode: StatusCodes.OK, - }); - }, - ).as('getMembers'); -}; - -export const mockGetMembersBy = ( - members: Member[], - shouldThrowError: boolean, -): void => { - cy.intercept( - { - method: HttpMethod.Get, - url: `${API_HOST}/members/search?email=*`, - }, - ({ reply, url }) => { - if (shouldThrowError) { - return reply({ statusCode: StatusCodes.BAD_REQUEST }); - } - - const emails = new URL(url).searchParams.getAll('email'); - - // TODO - const result: { - data: { [key: string]: Member }; - errors: unknown[]; - } = { - data: {}, - errors: [], - }; - emails.forEach((mail) => { - members - .filter(({ email }) => email === mail) - .forEach((m) => { - result.data[m.email] = m; - }); - }); - - return reply(result); - }, - ).as('getMembersBy'); -}; - export const mockEditMember = ( _members: Member[], shouldThrowError: boolean, diff --git a/package.json b/package.json index b2bd45390..5d6e16c48 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@emotion/styled": "11.13.0", "@graasp/chatbox": "3.3.0", "@graasp/map": "1.19.0", - "@graasp/query-client": "5.4.0", + "@graasp/query-client": "5.4.1", "@graasp/sdk": "5.0.0", "@graasp/stylis-plugin-rtl": "2.2.0", "@graasp/translations": "1.41.0", diff --git a/yarn.lock b/yarn.lock index 974ac25b6..35daf9824 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1625,19 +1625,19 @@ __metadata: languageName: node linkType: hard -"@graasp/query-client@npm:5.4.0": - version: 5.4.0 - resolution: "@graasp/query-client@npm:5.4.0" +"@graasp/query-client@npm:5.4.1": + version: 5.4.1 + resolution: "@graasp/query-client@npm:5.4.1" dependencies: - "@tanstack/react-query": "npm:5.59.8" - "@tanstack/react-query-devtools": "npm:5.59.8" + "@tanstack/react-query": "npm:5.59.20" + "@tanstack/react-query-devtools": "npm:5.59.20" axios: "npm:1.7.7" http-status-codes: "npm:2.3.0" peerDependencies: "@graasp/sdk": ^4.0.0 "@graasp/translations": "*" react: ^18.0.0 - checksum: 10/ea6ed0b69366423bfdb118c48f685bbd5b39dc86a7c8bbcf44cf5332f854358d5d2628b1814d571cb9c5ce8212679304b3fa9cc291074c1da22072fc04319a20 + checksum: 10/97ff3caf0ca67a52f5735c2f74e6a08e75c1f2b721f73c500b5cfaf44fcbd96e398ea8cef845d195056cf851126da811396ef540dab34922ef53cc31dbcd7023 languageName: node linkType: hard @@ -2525,40 +2525,40 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:5.59.6": - version: 5.59.6 - resolution: "@tanstack/query-core@npm:5.59.6" - checksum: 10/4cd634f957175dde80ed8f2b47eb14803d959073b6dccb7868f5dd6ddce26e41820b2dfc879dfc799de0726ae640201440c7d1d95113813bbcb25b03ec05949e +"@tanstack/query-core@npm:5.59.20": + version: 5.59.20 + resolution: "@tanstack/query-core@npm:5.59.20" + checksum: 10/efe34f0a05f4cdef833c3885f466bab8ecee22677a9056d161087658539c1dd14063cc19c08b8f2e56cafc4692fcde7fb4fc4962df59159b1da12c49e69892df languageName: node linkType: hard -"@tanstack/query-devtools@npm:5.58.0": - version: 5.58.0 - resolution: "@tanstack/query-devtools@npm:5.58.0" - checksum: 10/ca16c47c943ea392dfddc301f7e09ecdb0c8b905fb684b8f26b908a244e2e897679efb0ead5fa8e728711017341fdd91d8c51ebb19f746819e26ade5549f539e +"@tanstack/query-devtools@npm:5.59.20": + version: 5.59.20 + resolution: "@tanstack/query-devtools@npm:5.59.20" + checksum: 10/0bb2995337d78910c7677f780af42cd4285b39d618cd7876e24ec16243783d4cfe9e4d067d210d5337aefaad0a21928c5e4cb30fb4c08a09521625fcfe9c14d4 languageName: node linkType: hard -"@tanstack/react-query-devtools@npm:5.59.8": - version: 5.59.8 - resolution: "@tanstack/react-query-devtools@npm:5.59.8" +"@tanstack/react-query-devtools@npm:5.59.20": + version: 5.59.20 + resolution: "@tanstack/react-query-devtools@npm:5.59.20" dependencies: - "@tanstack/query-devtools": "npm:5.58.0" + "@tanstack/query-devtools": "npm:5.59.20" peerDependencies: - "@tanstack/react-query": ^5.59.8 + "@tanstack/react-query": ^5.59.20 react: ^18 || ^19 - checksum: 10/1e84af45cd6c722b296aef39ac2e7c98ef0db8c963bc43ebd802adc7077d514d06189862b02351e85878616542877af64266965147d75470cf834a23a9ee07ea + checksum: 10/71cf2fa81ce1d7a7e35acd9f45a4c398272f69e8ab962c5fcf686b8bf5144ca8e8702049bad452186963b4b820703c19ba9372149fd56ec95fef5390c5d7346c languageName: node linkType: hard -"@tanstack/react-query@npm:5.59.8": - version: 5.59.8 - resolution: "@tanstack/react-query@npm:5.59.8" +"@tanstack/react-query@npm:5.59.20": + version: 5.59.20 + resolution: "@tanstack/react-query@npm:5.59.20" dependencies: - "@tanstack/query-core": "npm:5.59.6" + "@tanstack/query-core": "npm:5.59.20" peerDependencies: react: ^18 || ^19 - checksum: 10/246cfa18e991782c97631ab30fc95987be81c7a25b057b65c3530a06f9e8acc98475ce8def29486be8d4c8f9ad391b9cfa2195b89e11dcd82f43a4ca172154f6 + checksum: 10/4bfface953fedb124c5b30d46d22e46b18dc9c53a30ad20493c2ce70dc03058d78815c2a8a8a4f0bd279dae29469b923ccb346c69485f00c1808fa7ac908d6b4 languageName: node linkType: hard @@ -6401,7 +6401,7 @@ __metadata: "@emotion/styled": "npm:11.13.0" "@graasp/chatbox": "npm:3.3.0" "@graasp/map": "npm:1.19.0" - "@graasp/query-client": "npm:5.4.0" + "@graasp/query-client": "npm:5.4.1" "@graasp/sdk": "npm:5.0.0" "@graasp/stylis-plugin-rtl": "npm:2.2.0" "@graasp/translations": "npm:1.41.0"