From c24d8fab0fa23a06789a282db709a85c995327b4 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Fri, 7 Jan 2022 17:14:36 +0200 Subject: [PATCH] chore(tests): update AccessControlForm snapshots [EE-2348] (#6361) --- .../accessControlForm/AccessControlForm.test.tsx | 14 ++++---------- .../AccessControlForm.validation.test.ts.snap | 4 ---- package.json | 4 ++-- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/app/portainer/components/accessControlForm/AccessControlForm.test.tsx b/app/portainer/components/accessControlForm/AccessControlForm.test.tsx index 2ee876b46..5ba65ed2a 100644 --- a/app/portainer/components/accessControlForm/AccessControlForm.test.tsx +++ b/app/portainer/components/accessControlForm/AccessControlForm.test.tsx @@ -2,11 +2,7 @@ import { server, rest } from '@/setup-tests/server'; import { ResourceControlOwnership as RCO } from '@/portainer/models/resourceControl/resourceControlOwnership'; import { UserContext } from '@/portainer/hooks/useUser'; import { UserViewModel } from '@/portainer/models/user'; -import { - renderWithQueryClient, - within, - waitFor, -} from '@/react-tools/test-utils'; +import { renderWithQueryClient, within } from '@/react-tools/test-utils'; import { Team } from '@/portainer/teams/types'; import { ResourceControlViewModel } from '@/portainer/models/resourceControl/resourceControl'; import { createMockTeams } from '@/react-tools/test-mocks'; @@ -310,11 +306,9 @@ async function renderComponent( ); - await waitFor(async () => - expect( - await renderResult.findByLabelText(/Enable access control/) - ).toBeVisible() - ); + await expect( + renderResult.findByLabelText(/Enable access control/) + ).resolves.toBeVisible(); return renderResult; } diff --git a/app/portainer/components/accessControlForm/__snapshots__/AccessControlForm.validation.test.ts.snap b/app/portainer/components/accessControlForm/__snapshots__/AccessControlForm.validation.test.ts.snap index 8738662d3..9fff3ddd5 100644 --- a/app/portainer/components/accessControlForm/__snapshots__/AccessControlForm.validation.test.ts.snap +++ b/app/portainer/components/accessControlForm/__snapshots__/AccessControlForm.validation.test.ts.snap @@ -4,10 +4,6 @@ exports[`when access control is enabled, ownership is restricted and no teams or exports[`when access control is enabled, ownership is restricted and no teams or users, should be invalid 2`] = `"You must specify at least one team"`; -exports[`when access control is enabled, ownership is restricted and no teams or users, should be valid 1`] = `"You must specify at least one team"`; - -exports[`when access control is enabled, ownership is restricted and no teams or users, should be valid 2`] = `"You must specify at least one team"`; - exports[`when access control is enabled, ownership is restricted, user is admin but no users, should be valid 1`] = `"You must specify at least one user."`; exports[`when only access control is enabled, should be invalid 1`] = `"ownership is a required field"`; diff --git a/package.json b/package.json index 5e63b0dd4..9de1a82df 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,7 @@ "rc-slider": "^9.7.5", "react": "^17.0.2", "react-dom": "^17.0.2", + "react-query": "^3.34.3", "react-is": "^17.0.2", "react-select": "^5.2.1", "react-table": "^7.7.0", @@ -214,7 +215,6 @@ "postcss": "7", "postcss-loader": "4", "prettier": "^2.5.1", - "react-query": "^3.34.3", "react-test-renderer": "^17.0.2", "source-map-loader": "^3.0.0", "speed-measure-webpack-plugin": "^1.5.0", @@ -247,4 +247,4 @@ "pre-commit": "lint-staged" } } -} +} \ No newline at end of file