mirror of
https://github.com/apache/superset.git
synced 2026-08-04 04:52:32 +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:
@@ -53,17 +53,17 @@ const setup = (props?: Partial<RunQueryActionButtonProps>, store?: Store) =>
|
||||
...(store && { store }),
|
||||
});
|
||||
|
||||
it('renders a single Button', () => {
|
||||
test('renders a single Button', () => {
|
||||
const { getByRole } = setup({}, mockStore(initialState));
|
||||
expect(getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders a label for Run Query', () => {
|
||||
test('renders a label for Run Query', () => {
|
||||
const { getByText } = setup({}, mockStore(initialState));
|
||||
expect(getByText('Run')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders a label for Selected Query', () => {
|
||||
test('renders a label for Selected Query', () => {
|
||||
const { getByText } = setup(
|
||||
{},
|
||||
mockStore({
|
||||
@@ -80,7 +80,7 @@ it('renders a label for Selected Query', () => {
|
||||
expect(getByText('Run selection')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('disable button when sql from unsaved changes is empty', () => {
|
||||
test('disable button when sql from unsaved changes is empty', () => {
|
||||
const { getByRole } = setup(
|
||||
{},
|
||||
mockStore({
|
||||
@@ -98,7 +98,7 @@ it('disable button when sql from unsaved changes is empty', () => {
|
||||
expect(button).toBeDisabled();
|
||||
});
|
||||
|
||||
it('disable button when selectedText only contains blank contents', () => {
|
||||
test('disable button when selectedText only contains blank contents', () => {
|
||||
const { getByRole } = setup(
|
||||
{},
|
||||
mockStore({
|
||||
@@ -116,7 +116,7 @@ it('disable button when selectedText only contains blank contents', () => {
|
||||
expect(button).toBeDisabled();
|
||||
});
|
||||
|
||||
it('enable default button for unrelated unsaved changes', () => {
|
||||
test('enable default button for unrelated unsaved changes', () => {
|
||||
const { getByRole } = setup(
|
||||
{},
|
||||
mockStore({
|
||||
@@ -134,7 +134,7 @@ it('enable default button for unrelated unsaved changes', () => {
|
||||
expect(button).toBeEnabled();
|
||||
});
|
||||
|
||||
it('dispatch runQuery on click', async () => {
|
||||
test('dispatch runQuery on click', async () => {
|
||||
const runQuery = jest.fn();
|
||||
const { getByRole } = setup({ runQuery }, mockStore(initialState));
|
||||
const button = getByRole('button');
|
||||
@@ -143,7 +143,7 @@ it('dispatch runQuery on click', async () => {
|
||||
await waitFor(() => expect(runQuery).toHaveBeenCalledTimes(1));
|
||||
});
|
||||
|
||||
it('dispatch stopQuery on click while running state', async () => {
|
||||
test('dispatch stopQuery on click while running state', async () => {
|
||||
const stopQuery = jest.fn();
|
||||
const { getByRole } = setup(
|
||||
{ queryState: 'running', stopQuery },
|
||||
|
||||
Reference in New Issue
Block a user