From f163e347d2a966ed6a524d9ca6c4b54f3cf80db0 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 12 Feb 2024 12:49:55 -0800 Subject: [PATCH] Add darwin/Tests/ to packages test pattern (#3486) By repo convention, plugins using the shared darwin source structure put unit tests in darwin/Tests/ --- .../github/webhook_subscription.dart | 1 + .../github/webhook_subscription_test.dart | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index 78d04242e..1b94f14b7 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -473,6 +473,7 @@ class GithubWebhookSubscription extends SubscriptionHandler { // Native iOS/macOS tests. filename.contains('RunnerTests/') || filename.contains('RunnerUITests/') || + filename.contains('darwin/Tests/') || // Native Android tests. filename.contains('android/src/test/') || filename.contains('androidTest/') || diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 668f24452..50c7336b5 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -1824,6 +1824,33 @@ void foo() { ); }); + test('Packages does not comment if shared Darwin native tests', () async { + const int issueNumber = 123; + + tester.message = generateGithubWebhookMessage( + action: 'opened', + number: issueNumber, + slug: Config.packagesSlug, + baseRef: Config.defaultBranch(Config.packagesSlug), + ); + when(pullRequestsService.listFiles(Config.packagesSlug, issueNumber)).thenAnswer( + (_) => Stream.fromIterable([ + PullRequestFile()..filename = 'packages/foo/foo_foundation/darwin/Classes/SomeClass.m', + PullRequestFile()..filename = 'packages/foo/foo_foundation/darwin/Tests/SomeClassTest.m', + ]), + ); + + await tester.post(webhook); + + verifyNever( + issuesService.createComment( + Config.packagesSlug, + issueNumber, + argThat(contains(config.missingTestsPullRequestMessageValue)), + ), + ); + }); + test('Packages does not comment if editing test files in go_router', () async { const int issueNumber = 123;