expectResourceExists function
Fails the current test if the server behind harness does not list a
resource with the given uri.
Implementation
Future<void> expectResourceExists(McpServerHarness harness, String uri) async {
final result = await harness.listResources();
final uris = [
for (final resource in result.resources)
_describe((resource as Map<String, Object?>)['uri'], '<no uri>'),
];
if (!uris.contains(uri)) {
fail(
'Expected the server to list a resource with URI "$uri". '
'Listed resources: ${uris.isEmpty ? '(none)' : uris.join(', ')}.',
);
}
}