This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch gpt-rtl-tests2
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 00f7360828234e77065836f5c1f4834dec730a42
Author: Evan Rusackas <[email protected]>
AuthorDate: Sun May 21 10:31:54 2023 -0600

    chore(tests): GPT-generated RTL tests for EmptyState component
---
 .../src/components/EmptyState/EmptyState.test.tsx  | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/superset-frontend/src/components/EmptyState/EmptyState.test.tsx 
b/superset-frontend/src/components/EmptyState/EmptyState.test.tsx
new file mode 100644
index 0000000000..649ffb6c2c
--- /dev/null
+++ b/superset-frontend/src/components/EmptyState/EmptyState.test.tsx
@@ -0,0 +1,34 @@
+import { render, screen, fireEvent } from '@testing-library/react';
+import { EmptyStateSmall, EmptyStateMedium, EmptyStateBig } from '.';
+import React from 'react';
+
+describe('<EmptyStateSmall />', () => {
+  it('renders without crashing', () => {
+    const props = { title: "No data", description: "Please try again later", 
image: "empty.svg" };
+    render(<EmptyStateSmall {...props} />);
+    expect(screen.getByText(props.title)).toBeInTheDocument();
+    expect(screen.getByText(props.description)).toBeInTheDocument();
+  });
+});
+
+describe('<EmptyStateMedium />', () => {
+  it('renders without crashing', () => {
+    const props = { title: "No data", description: "Please try again later", 
image: "empty.svg", buttonText: "Retry", buttonAction: jest.fn() };
+    render(<EmptyStateMedium {...props} />);
+    expect(screen.getByText(props.title)).toBeInTheDocument();
+    expect(screen.getByText(props.description)).toBeInTheDocument();
+    fireEvent.click(screen.getByText(props.buttonText));
+    expect(props.buttonAction).toHaveBeenCalledTimes(1);
+  });
+});
+
+describe('<EmptyStateBig />', () => {
+  it('renders without crashing', () => {
+    const props = { title: "No data", description: "Please try again later", 
image: "empty.svg", buttonText: "Retry", buttonAction: jest.fn() };
+    render(<EmptyStateBig {...props} />);
+    expect(screen.getByText(props.title)).toBeInTheDocument();
+    expect(screen.getByText(props.description)).toBeInTheDocument();
+    fireEvent.click(screen.getByText(props.buttonText));
+    expect(props.buttonAction).toHaveBeenCalledTimes(1);
+  });
+});

Reply via email to