mirror of
https://github.com/apache/superset.git
synced 2026-07-19 13:15:49 +00:00
test(frontend): Migrate from describe/it to flat test() pattern (#35305)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -56,15 +56,16 @@ const setup = (queryEditor: QueryEditor, store?: Store) =>
|
||||
...(store && { store }),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
|
||||
describe('SqlEditorTabHeader', () => {
|
||||
it('renders name', () => {
|
||||
test('renders name', () => {
|
||||
const { queryByText } = setup(defaultQueryEditor, mockStore(initialState));
|
||||
expect(queryByText(defaultQueryEditor.name)).toBeInTheDocument();
|
||||
expect(queryByText(extraQueryEditor1.name)).not.toBeInTheDocument();
|
||||
expect(queryByText(extraQueryEditor2.name)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders name from unsaved changes', () => {
|
||||
test('renders name from unsaved changes', () => {
|
||||
const expectedTitle = 'updated title';
|
||||
const { queryByText } = setup(
|
||||
defaultQueryEditor,
|
||||
@@ -85,7 +86,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
expect(queryByText(extraQueryEditor2.name)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders current name for unrelated unsaved changes', () => {
|
||||
test('renders current name for unrelated unsaved changes', () => {
|
||||
const unrelatedTitle = 'updated title';
|
||||
const { queryByText } = setup(
|
||||
defaultQueryEditor,
|
||||
@@ -106,6 +107,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
expect(queryByText(extraQueryEditor2.name)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
|
||||
describe('with dropdown menus', () => {
|
||||
let store = mockStore();
|
||||
beforeEach(async () => {
|
||||
@@ -116,7 +118,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
userEvent.click(dropdown);
|
||||
});
|
||||
|
||||
it('should dispatch removeQueryEditor action', async () => {
|
||||
test('should dispatch removeQueryEditor action', async () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
|
||||
);
|
||||
@@ -132,7 +134,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should dispatch queryEditorSetTitle action', async () => {
|
||||
test('should dispatch queryEditorSetTitle action', async () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
|
||||
);
|
||||
@@ -155,7 +157,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
mockPrompt.mockClear();
|
||||
});
|
||||
|
||||
it('should dispatch toggleLeftBar action', async () => {
|
||||
test('should dispatch toggleLeftBar action', async () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
|
||||
);
|
||||
@@ -173,7 +175,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should dispatch removeAllOtherQueryEditors action', async () => {
|
||||
test('should dispatch removeAllOtherQueryEditors action', async () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
|
||||
);
|
||||
@@ -194,7 +196,7 @@ describe('SqlEditorTabHeader', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should dispatch cloneQueryToNewTab action', async () => {
|
||||
test('should dispatch cloneQueryToNewTab action', async () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('close-tab-menu-option')).toBeInTheDocument(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user