fix(frontend): remove describe/it blocks from Modal.useModal tests (#35497)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Joe Li
2025-10-03 20:34:30 -07:00
committed by GitHub
parent 635b7a6a4d
commit 821173f6c4
3 changed files with 7 additions and 8 deletions

View File

@@ -174,6 +174,7 @@ test('adds extension to DashboardEmbedModal', async () => {
extensionsRegistry.set('embedded.modal', undefined);
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('Modal.useModal integration', () => {
beforeEach(() => {
jest.clearAllMocks();

View File

@@ -201,12 +201,13 @@ describe('ThemesList', () => {
expect(addButton).toBeInTheDocument();
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('Modal.useModal integration', () => {
beforeEach(() => {
jest.clearAllMocks();
});
it('uses Modal.useModal hook instead of Modal.confirm', () => {
test('uses Modal.useModal hook instead of Modal.confirm', () => {
const useModalSpy = jest.spyOn(Modal, 'useModal');
renderThemesList();
@@ -216,7 +217,7 @@ describe('ThemesList', () => {
useModalSpy.mockRestore();
});
it('renders contextHolder for modal theming', async () => {
test('renders contextHolder for modal theming', async () => {
const { container } = renderThemesList();
// Wait for component to be rendered
@@ -228,7 +229,7 @@ describe('ThemesList', () => {
expect(contextHolderExists).toBeDefined();
});
it('confirms system theme changes using themed modal', async () => {
test('confirms system theme changes using themed modal', async () => {
const mockSetSystemDefault = jest.fn().mockResolvedValue({});
fetchMock.post(
'glob:*/api/v1/theme/*/set_system_default',
@@ -246,7 +247,7 @@ describe('ThemesList', () => {
expect(true).toBe(true);
});
it('does not use deprecated Modal.confirm directly', () => {
test('does not use deprecated Modal.confirm directly', () => {
// Create a spy on the static Modal.confirm method
const confirmSpy = jest.spyOn(Modal, 'confirm');

View File

@@ -294,10 +294,7 @@ function ThemesList({
theme.theme_name,
),
onConfirm: () => setSystemDarkTheme(theme.id!),
successMessage: t(
'"%s" is now the system dark theme',
theme.theme_name,
),
successMessage: t('"%s" is now the system dark theme', theme.theme_name),
errorMessage: 'Failed to set system dark theme: %s',
});
};