1+ import { TRPCClientError } from '@trpc/client'
12import {
3+ afterEach ,
4+ beforeEach ,
25 describe ,
3- it ,
46 expect ,
5- vi ,
6- beforeEach ,
7- afterEach ,
7+ it ,
88 type Mock ,
9+ vi ,
910} from 'vitest'
10- import { TRPCClientError } from '@trpc/client'
11+
1112import { webExtensionLink } from './'
13+
14+ import type { Operation , TRPCClientRuntime } from '@trpc/client'
1215import type { Runtime } from 'webextension-polyfill'
13- import type { Operation } from '@trpc/client'
1416
1517// Mock runtime
1618const mockRuntime = {
@@ -147,7 +149,7 @@ describe('webExtensionLink', () => {
147149 runtime : mockRuntime ,
148150 transformer : mockTransformer ,
149151 } )
150- operationLink = link ( )
152+ operationLink = link ( { } as TRPCClientRuntime )
151153 } )
152154
153155 it ( 'should serialize input before sending' , ( ) => {
@@ -253,7 +255,7 @@ describe('webExtensionLink', () => {
253255 runtime : mockRuntime ,
254256 transformer : mockTransformer ,
255257 } )
256- operationLink = link ( )
258+ operationLink = link ( { } as TRPCClientRuntime )
257259 } )
258260
259261 it ( 'should ignore non-tRPC messages' , ( ) => {
@@ -525,7 +527,7 @@ describe('webExtensionLink', () => {
525527 runtime : mockRuntime ,
526528 transformer : mockTransformer ,
527529 } )
528- operationLink = link ( )
530+ operationLink = link ( { } as TRPCClientRuntime )
529531 } )
530532
531533 it ( 'should not complete subscription on data' , ( ) => {
@@ -642,7 +644,7 @@ describe('webExtensionLink', () => {
642644 transformer : mockTransformer ,
643645 timeoutMS : 1000 ,
644646 } )
645- operationLink = link ( )
647+ operationLink = link ( { } as TRPCClientRuntime )
646648 } )
647649
648650 afterEach ( ( ) => {
@@ -752,10 +754,8 @@ describe('webExtensionLink', () => {
752754 } )
753755
754756 describe ( 'Port Disconnection' , ( ) => {
755- let link : ReturnType < typeof webExtensionLink >
756-
757757 beforeEach ( ( ) => {
758- link = webExtensionLink ( {
758+ webExtensionLink ( {
759759 runtime : mockRuntime ,
760760 transformer : mockTransformer ,
761761 } )
@@ -777,7 +777,7 @@ describe('webExtensionLink', () => {
777777 ; ( mockRuntime . connect as Mock ) . mockReturnValue ( newMockPort )
778778
779779 // Create new link - should reconnect
780- const newLink = webExtensionLink ( {
780+ webExtensionLink ( {
781781 runtime : mockRuntime ,
782782 transformer : mockTransformer ,
783783 } )
@@ -795,7 +795,7 @@ describe('webExtensionLink', () => {
795795 runtime : mockRuntime ,
796796 transformer : mockTransformer ,
797797 } )
798- operationLink = link ( )
798+ operationLink = link ( { } as TRPCClientRuntime )
799799 } )
800800
801801 it ( 'should handle transformer that returns undefined' , ( ) => {
0 commit comments