bito-code-review[bot] commented on PR #40760:
URL: https://github.com/apache/superset/pull/40760#issuecomment-4633893599

   <!-- Bito Reply -->
   To make the cleanup safe and avoid errors when a test does not assign the 
spy, you can check if `locationSpy` exists before calling `mockRestore` in 
`afterEach`. Alternatively, you can initialize the spy as `undefined` and use 
optional chaining.
   
   **superset-frontend/src/embedded/getInitialThemeMode.test.ts**
   ```
   let locationSpy: jest.SpyInstance | undefined;
   
   afterEach(() => {
     locationSpy?.mockRestore();
   });
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to