From a22441d5007194a61ea985648876cca205642059 Mon Sep 17 00:00:00 2001
From: Phoomparin Mano <poom@metabase.com>
Date: Mon, 28 Oct 2024 20:25:01 +0700
Subject: [PATCH] test(sdk): assert abort calls on static question unmount
 (#49197)

---
 .../public/StaticQuestion/StaticQuestion.unit.spec.tsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.unit.spec.tsx
index 2a595bb5bc2..264abca5fef 100644
--- a/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.unit.spec.tsx
+++ b/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.unit.spec.tsx
@@ -180,14 +180,14 @@ describe("StaticQuestion", () => {
     const abortSpy = jest.spyOn(AbortController.prototype, "abort");
 
     const { unmount } = setup();
-
     await act(async () => unmount());
 
-    expect(abortSpy).toHaveBeenCalled();
-    abortSpy.mockRestore();
-
-    // sanity check that the two requests were made initially
+    // two requests should've been made initially
     expect(fetchMock.calls(`path:/api/card/1`).length).toBe(1);
     expect(fetchMock.calls(`path:/api/card/1/query`).length).toBe(1);
+
+    // consequently, two abort calls should've been made for the two requests
+    expect(abortSpy).toHaveBeenCalledTimes(2);
+    abortSpy.mockRestore();
   });
 });
-- 
GitLab