File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,20 @@ import { useAvailableScripts } from "./useAvailableScripts";
1515// Define types for our mock
1616type ListScriptsMock = Mock < ( ) => Promise < { success : boolean ; data ?: unknown [ ] ; error ?: string } > > ;
1717
18+ interface CustomWindow extends Window {
19+ api ?: {
20+ workspace : {
21+ listScripts : ListScriptsMock ;
22+ } ;
23+ } ;
24+ }
25+
1826describe ( "useAvailableScripts" , ( ) => {
1927 const mockListScripts = mock ( ) as unknown as ListScriptsMock ;
2028
2129 beforeEach ( ( ) => {
2230 // Mock window.api attached to the global window
23- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
24- ( global . window as any ) . api = {
31+ ( global . window as unknown as CustomWindow ) . api = {
2532 workspace : {
2633 listScripts : mockListScripts ,
2734 } ,
@@ -30,8 +37,7 @@ describe("useAvailableScripts", () => {
3037
3138 afterEach ( ( ) => {
3239 mock . restore ( ) ;
33- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
34- delete ( global . window as any ) . api ;
40+ delete ( global . window as unknown as CustomWindow ) . api ;
3541 } ) ;
3642
3743 it ( "should fetch and return executable scripts" , async ( ) => {
You can’t perform that action at this time.
0 commit comments