From b500922a0bf14af4b2e1db6a8b9cf4ab1090f111 Mon Sep 17 00:00:00 2001 From: Alexander Sandor Date: Mon, 25 Nov 2024 13:16:38 +0100 Subject: [PATCH] test: add additional test validation. --- .../update_file_context_test.dart | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/serverpod_cli/test/integration/analyzer/dart/endpoint_validation/update_file_context_test.dart b/tools/serverpod_cli/test/integration/analyzer/dart/endpoint_validation/update_file_context_test.dart index e87673c21d..a9b066882c 100644 --- a/tools/serverpod_cli/test/integration/analyzer/dart/endpoint_validation/update_file_context_test.dart +++ b/tools/serverpod_cli/test/integration/analyzer/dart/endpoint_validation/update_file_context_test.dart @@ -165,6 +165,28 @@ class ExampleClass {} completion(false), ); }); + + test( + 'when the file context is updated with a new endpoint file ' + 'then true is returned.', () async { + var newEndpointFile = + File(path.join(trackedDirectory.path, 'new_endpoint.dart')); + newEndpointFile.createSync(recursive: true); + newEndpointFile.writeAsStringSync(''' +import 'package:serverpod/serverpod.dart'; + +class NewEndpoint extends Endpoint { + Future hello(Session session, String name) async { + return 'Hello \$name'; + }); +} + '''); + + await expectLater( + analyzer.updateFileContexts({newEndpointFile.path}), + completion(true), + ); + }); }); group('Given a tracked and analyzed directory with valid non-endpoint file',