Browse Source

chore(api): Convert api test to typescript (#35172)

Alberto Leal 2 years ago
parent
commit
3c6f0c8fdf
1 changed files with 6 additions and 4 deletions
  1. 6 4
      tests/js/spec/api.spec.tsx

+ 6 - 4
tests/js/spec/api.spec.jsx → tests/js/spec/api.spec.tsx

@@ -16,8 +16,10 @@ describe('api', function () {
         const abort1 = jest.fn();
         const abort2 = jest.fn();
 
-        const req1 = new Request(new Promise(() => null), {abort: abort1});
-        const req2 = new Request(new Promise(() => null), {abort: abort2});
+        const req1 = new Request(new Promise(() => null), {
+          abort: abort1,
+        } as any);
+        const req2 = new Request(new Promise(() => null), {abort: abort2} as any);
 
         api.activeRequests = {
           1: req1,
@@ -26,8 +28,8 @@ describe('api', function () {
 
         api.clear();
 
-        expect(req1.aborter.abort).toHaveBeenCalledTimes(1);
-        expect(req2.aborter.abort).toHaveBeenCalledTimes(1);
+        expect(req1.aborter?.abort).toHaveBeenCalledTimes(1);
+        expect(req2.aborter?.abort).toHaveBeenCalledTimes(1);
       });
     });
   });