Browse Source

chore(ts): Convert a few tests to ts (#49579)

Evan Purkhiser 1 year ago
parent
commit
c94d0ce381

+ 1 - 1
static/app/actionCreators/organization.spec.jsx → static/app/actionCreators/organization.spec.tsx

@@ -73,7 +73,7 @@ describe('OrganizationActionCreator', function () {
     expect(TeamStore.loadInitialData).toHaveBeenCalledWith(teams);
     expect(ProjectsStore.loadInitialData).toHaveBeenCalledWith(projects);
 
-    expect(OrganizationStore.organization).toEqual(org);
+    expect(OrganizationStore.get().organization).toEqual(org);
   });
 
   it('silently fetches organization details', async function () {

+ 4 - 2
static/app/components/charts/intervalSelector.spec.jsx → static/app/components/charts/intervalSelector.spec.tsx

@@ -14,14 +14,16 @@ describe('IntervalSelector', function () {
     projects: [project.id],
   });
   it('resets small interval', function () {
-    let interval = '1s';
+    let interval: string | undefined = '1s';
     eventView.interval = interval;
     eventView.statsPeriod = '90d';
     const intervalSelector = (
       <IntervalSelector
         eventView={eventView}
         displayMode={DisplayModes.DEFAULT}
-        onIntervalChange={newInterval => (interval = newInterval)}
+        onIntervalChange={newInterval => {
+          interval = newInterval;
+        }}
       />
     );
     render(intervalSelector);

+ 2 - 2
static/app/components/collapsible.spec.jsx → static/app/components/collapsible.spec.tsx

@@ -49,9 +49,9 @@ describe('Collapsible', function () {
         collapseButton={({onCollapse}) => (
           <Button onClick={onCollapse}>Custom Collapse</Button>
         )}
-        expandButton={({onExpand, numberOfCollapsedItems}) => (
+        expandButton={({onExpand, numberOfHiddenItems}) => (
           <Button onClick={onExpand} aria-label="Expand">
-            Custom Expand {numberOfCollapsedItems}
+            Custom Expand {numberOfHiddenItems}
           </Button>
         )}
       >

+ 0 - 28
static/app/components/globalModal/index.spec.jsx → static/app/components/globalModal/index.spec.tsx

@@ -1,6 +1,5 @@
 import {
   act,
-  render,
   renderGlobalModal,
   screen,
   userEvent,
@@ -105,33 +104,6 @@ describe('GlobalModal', function () {
     expect(closeSpy).toHaveBeenCalled();
   });
 
-  it("ignores click out with backdrop: 'static'", async function () {
-    const {waitForModalToHide} = renderGlobalModal();
-    render(<div data-test-id="outside-test">Hello</div>);
-
-    act(() =>
-      openModal(
-        ({Header}) => (
-          <div data-test-id="modal-test">
-            <Header closeButton>Header</Header>Hi
-          </div>
-        ),
-        {backdrop: 'static'}
-      )
-    );
-
-    expect(screen.getByTestId('modal-test')).toBeInTheDocument();
-
-    // Clicking outside of modal doesn't close
-    await userEvent.click(screen.getByTestId('outside-test'));
-    expect(screen.getByTestId('modal-test')).toBeInTheDocument();
-
-    // Pressing escape _does_ close
-    await userEvent.keyboard('{Escape}');
-    expect(screen.getByTestId('modal-test')).toBeInTheDocument();
-    await waitForModalToHide();
-  });
-
   it("ignores click out with closeEvents: 'escape-key'", async function () {
     const {waitForModalToHide} = renderGlobalModal();
     const closeSpy = jest.fn();