@@ -22,8 +22,9 @@ vi.mock("../server/bridge/fns", () => ({ bridgeStatusFn: bridgeStatus }));
2222afterEach ( cleanup ) ;
2323beforeEach ( ( ) => bridgeStatus . mockReset ( ) ) ;
2424
25- function renderIndicator ( ) {
25+ async function renderIndicator ( ) {
2626 const client = new QueryClient ( { defaultOptions : { queries : { retry : false } } } ) ;
27+ client . setQueryData ( [ "bridgeStatus" ] , await bridgeStatus ( ) ) ;
2728 return render (
2829 < QueryClientProvider client = { client } >
2930 < BridgeIndicator />
@@ -42,7 +43,7 @@ describe("BridgeIndicator", () => {
4243 appProtocolVersion : 4 ,
4344 lastPeer : { lastSeenMs : Date . now ( ) , protocolVersion : 4 , player : "jim" } ,
4445 } ) ;
45- const { findByText, findByRole, getByTestId } = renderIndicator ( ) ;
46+ const { findByText, findByRole, getByTestId } = await renderIndicator ( ) ;
4647 expect ( await findByText ( "game linked" ) ) . toBeTruthy ( ) ;
4748 expect ( dot ( getByTestId ( "bridge-link" ) ) . className ) . toContain ( "bg-success" ) ;
4849 fireEvent . focus ( getByTestId ( "bridge-link" ) ) ;
@@ -57,7 +58,7 @@ describe("BridgeIndicator", () => {
5758 appProtocolVersion : 4 ,
5859 lastPeer : { lastSeenMs : Date . now ( ) , protocolVersion : 3 , player : "jim" } ,
5960 } ) ;
60- const { findByText, getByTestId } = renderIndicator ( ) ;
61+ const { findByText, getByTestId } = await renderIndicator ( ) ;
6162 expect ( await findByText ( "mod mismatch" ) ) . toBeTruthy ( ) ;
6263 expect ( dot ( getByTestId ( "bridge-link" ) ) . className ) . toContain ( "bg-destructive" ) ;
6364 } ) ;
@@ -70,7 +71,7 @@ describe("BridgeIndicator", () => {
7071 appProtocolVersion : 4 ,
7172 lastPeer : null ,
7273 } ) ;
73- const { findByText, getByTestId } = renderIndicator ( ) ;
74+ const { findByText, getByTestId } = await renderIndicator ( ) ;
7475 expect ( await findByText ( "no game" ) ) . toBeTruthy ( ) ;
7576 expect ( dot ( getByTestId ( "bridge-link" ) ) . className ) . toContain ( "bg-warning" ) ;
7677 } ) ;
@@ -83,7 +84,7 @@ describe("BridgeIndicator", () => {
8384 appProtocolVersion : 4 ,
8485 lastPeer : { lastSeenMs : Date . now ( ) - 60_000 , protocolVersion : 4 , player : "jim" } ,
8586 } ) ;
86- const { findByText } = renderIndicator ( ) ;
87+ const { findByText } = await renderIndicator ( ) ;
8788 expect ( await findByText ( "no game" ) ) . toBeTruthy ( ) ;
8889 } ) ;
8990
@@ -96,7 +97,7 @@ describe("BridgeIndicator", () => {
9697 appProtocolVersion : 4 ,
9798 lastPeer : null ,
9899 } ) ;
99- const { findByText, findByRole, getByTestId } = renderIndicator ( ) ;
100+ const { findByText, findByRole, getByTestId } = await renderIndicator ( ) ;
100101 expect ( await findByText ( "bridge error" ) ) . toBeTruthy ( ) ;
101102 fireEvent . focus ( getByTestId ( "bridge-link" ) ) ;
102103 expect ( ( await findByRole ( "tooltip" ) ) . textContent ) . toContain ( "EADDRINUSE" ) ;
0 commit comments