11import assert from "node:assert" ;
22
3- import waitForExpect from "@sadams/wait-for-expect" ;
4-
53it ( "handles notifications" , async ( ) => {
64 await using alice = await sessions . acquire ( ) ;
75 await using bob = await sessions . acquire ( ) ;
@@ -10,10 +8,14 @@ it("handles notifications", async () => {
108 } ) ;
119
1210 try {
13- await waitForExpect ( async ( ) => {
14- const unreadCount = await alice . rest . v1 . notifications . unreadCount . fetch ( ) ;
15- expect ( unreadCount . count ) . toBe ( 1 ) ;
16- } ) ;
11+ await vi . waitFor (
12+ async ( ) => {
13+ const unreadCount =
14+ await alice . rest . v1 . notifications . unreadCount . fetch ( ) ;
15+ expect ( unreadCount . count ) . toBe ( 1 ) ;
16+ } ,
17+ { timeout : 4500 } ,
18+ ) ;
1719
1820 let notifications = await alice . rest . v1 . notifications . list ( ) ;
1921 let notification = notifications . find ( ( n ) => n . status ?. id === status . id ) ;
@@ -52,12 +54,15 @@ it("clear notifications", async () => {
5254 try {
5355 let notifications = await alice . rest . v1 . notifications . list ( ) ;
5456
55- await waitForExpect ( async ( ) => {
56- notifications = await alice . rest . v1 . notifications . list ( ) ;
57- expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s1 ) ;
58- expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s2 ) ;
59- expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s3 ) ;
60- } ) ;
57+ await vi . waitFor (
58+ async ( ) => {
59+ notifications = await alice . rest . v1 . notifications . list ( ) ;
60+ expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s1 ) ;
61+ expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s2 ) ;
62+ expect ( notifications . map ( ( n ) => n . status ) ) . toContainEqual ( s3 ) ;
63+ } ,
64+ { timeout : 4500 } ,
65+ ) ;
6166
6267 expect ( notifications . length >= 3 ) . toBe ( true ) ;
6368
0 commit comments