Browse Source

ref(ts): Migrate First Event Indicator test from .jsx to .tsx (#52853)

Priscila Oliveira 1 year ago
parent
commit
dc32e853f6

+ 0 - 34
static/app/views/onboarding/components/firstEventIndicator.spec.jsx

@@ -1,34 +0,0 @@
-import {render, screen} from 'sentry-test/reactTestingLibrary';
-
-import {Indicator} from 'sentry/views/onboarding/components/firstEventIndicator';
-
-describe('FirstEventIndicator', function () {
-  it('renders waiting status', function () {
-    const org = TestStubs.Organization();
-
-    render(<Indicator organization={org} firstIssue={null} />);
-    expect(
-      screen.getByText('Waiting to receive first event to continue')
-    ).toBeInTheDocument();
-  });
-
-  describe('received first event', function () {
-    it('renders', function () {
-      const org = TestStubs.Organization();
-
-      render(<Indicator organization={org} firstIssue={{id: 1}} />);
-
-      expect(screen.getByText('Event was received!')).toBeInTheDocument();
-    });
-
-    it('renders without a known issue ID', function () {
-      const org = TestStubs.Organization();
-      const project = TestStubs.ProjectDetails({});
-
-      render(<Indicator organization={org} project={project} firstIssue />);
-
-      // No button when there is no known issue ID
-      expect(screen.getByText('Event was received!')).toBeInTheDocument();
-    });
-  });
-});

+ 55 - 0
static/app/views/onboarding/components/firstEventIndicator.spec.tsx

@@ -0,0 +1,55 @@
+import {initializeOrg} from 'sentry-test/initializeOrg';
+import {render, screen} from 'sentry-test/reactTestingLibrary';
+
+import {Indicator} from 'sentry/views/onboarding/components/firstEventIndicator';
+
+describe('FirstEventIndicator', function () {
+  it('renders waiting status', function () {
+    const {project, organization} = initializeOrg();
+
+    render(
+      <Indicator
+        organization={organization}
+        project={project}
+        firstIssue={null}
+        eventType="error"
+      />
+    );
+    expect(
+      screen.getByText('Waiting to receive first event to continue')
+    ).toBeInTheDocument();
+  });
+
+  describe('received first event', function () {
+    it('renders', function () {
+      const {project, organization} = initializeOrg();
+
+      render(
+        <Indicator
+          organization={organization}
+          project={project}
+          eventType="error"
+          firstIssue={TestStubs.Group({id: 1})}
+        />
+      );
+
+      expect(screen.getByText('Event was received!')).toBeInTheDocument();
+    });
+
+    it('renders without a known issue ID', function () {
+      const {project, organization} = initializeOrg();
+
+      render(
+        <Indicator
+          organization={organization}
+          eventType="error"
+          project={project}
+          firstIssue
+        />
+      );
+
+      // No button when there is no known issue ID
+      expect(screen.getByText('Event was received!')).toBeInTheDocument();
+    });
+  });
+});