File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
tests/integration/resources Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,23 @@ describeWithMongoDB(
74
74
expect ( exportedResourceURI ) . toBeDefined ( ) ;
75
75
76
76
// wait for export expired
77
- await timeout ( 300 ) ;
78
- const response = await integration . mcpClient ( ) . readResource ( {
79
- uri : exportedResourceURI as string ,
80
- } ) ;
81
- expect ( response . isError ) . toEqual ( true ) ;
82
- expect ( response . contents [ 0 ] ?. uri ) . toEqual ( exportedResourceURI ) ;
83
- expect ( response . contents [ 0 ] ?. text ) . toMatch ( `Error reading ${ exportedResourceURI } :` ) ;
77
+ for ( let tries = 0 ; tries < 10 ; tries ++ ) {
78
+ await timeout ( 300 ) ;
79
+ const response = await integration . mcpClient ( ) . readResource ( {
80
+ uri : exportedResourceURI as string ,
81
+ } ) ;
82
+
83
+ // wait for an error from the MCP Server as it
84
+ // means the resource is not available anymore
85
+ if ( response . isError === false ) {
86
+ continue ;
87
+ }
88
+
89
+ expect ( response . isError ) . toEqual ( true ) ;
90
+ expect ( response . contents [ 0 ] ?. uri ) . toEqual ( exportedResourceURI ) ;
91
+ expect ( response . contents [ 0 ] ?. text ) . toMatch ( `Error reading ${ exportedResourceURI } :` ) ;
92
+ break ;
93
+ }
84
94
} ) ;
85
95
} ) ;
86
96
You can’t perform that action at this time.
0 commit comments