Created
January 7, 2025 20:19
-
-
Save sjha4/5e45e328d229324453d08843be9d978a to your computer and use it in GitHub Desktop.
SmartProxyContentTest fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js b/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js | |
index 234fc35a71..501bf6df4f 100644 | |
--- a/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js | |
+++ b/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js | |
@@ -1,5 +1,5 @@ | |
import React from 'react'; | |
-import { renderWithRedux, patientlyWaitFor, within } from 'react-testing-lib-wrapper'; | |
+import { renderWithRedux, patientlyWaitFor, fireEvent, within, act } from 'react-testing-lib-wrapper'; | |
import { nockInstance, assertNockRequest } from '../../../test-utils/nockWrapper'; | |
import api from '../../../services/api'; | |
@@ -101,17 +101,19 @@ test('Can call content count refresh for environment', async (done) => { | |
.reply(202); | |
const { | |
- getByText, queryAllByLabelText, | |
+ getByText, getAllByLabelText, | |
} = renderWithRedux(contentTable); | |
await patientlyWaitFor(() => expect(getByText('Environment')).toBeInTheDocument()); | |
- const envRowActions = queryAllByLabelText('Actions')[0]; | |
- envRowActions.click(); | |
+ expect(getAllByLabelText('Kebab toggle')[0]).toHaveAttribute('aria-expanded', 'false'); | |
+ fireEvent.click(getAllByLabelText('Kebab toggle')[0]); | |
+ expect(getAllByLabelText('Kebab toggle')[0]).toHaveAttribute('aria-expanded', 'true'); | |
await patientlyWaitFor(() => expect(getByText('Refresh counts')).toBeInTheDocument()); | |
const refreshEnv = getByText('Refresh counts'); | |
refreshEnv.click(); | |
assertNockRequest(detailsScope); | |
assertNockRequest(countsEnvRefreshScope, done); | |
+ act(done); | |
}); | |
test('Can call content count refresh for content view', async (done) => { | |
@@ -129,7 +131,7 @@ test('Can call content count refresh for content view', async (done) => { | |
const { | |
- getByText, getAllByText, getByLabelText, queryAllByLabelText, | |
+ getByText, getAllByText, getByLabelText, getAllByLabelText, | |
} = renderWithRedux(contentTable); | |
await patientlyWaitFor(() => expect(getByText('Environment')).toBeInTheDocument()); | |
const tdEnvExpand = getByLabelText('expand-env-1'); | |
@@ -139,13 +141,15 @@ test('Can call content count refresh for content view', async (done) => { | |
expect(getAllByText('Last published')[0]).toBeInTheDocument(); | |
expect(getAllByText('Repository')[0]).toBeInTheDocument(); | |
expect(getAllByText('Synced')[0]).toBeInTheDocument(); | |
- const cvRowActions = queryAllByLabelText('Actions')[1]; | |
- cvRowActions.click(); | |
+ expect(getAllByLabelText('Kebab toggle')[1]).toHaveAttribute('aria-expanded', 'false'); | |
+ fireEvent.click(getAllByLabelText('Kebab toggle')[1]); | |
+ expect(getAllByLabelText('Kebab toggle')[1]).toHaveAttribute('aria-expanded', 'true'); | |
await patientlyWaitFor(() => expect(getByText('Refresh counts')).toBeInTheDocument()); | |
const refreshCvCounts = getByText('Refresh counts'); | |
refreshCvCounts.click(); | |
- assertNockRequest(detailsScope, done); | |
+ assertNockRequest(detailsScope); | |
assertNockRequest(countsCVRefreshScope, done); | |
+ act(done); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment