diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 77da3f5..63e7b5a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,16 +3,9 @@ name: linter on: push: branches: - - develop - main - - master - - workos + - staging pull_request: - branches: - - develop - - main - - master - - workos permissions: contents: write diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 080b5a7..ddab86b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,16 +3,9 @@ name: tests on: push: branches: - - develop - main - - master - - workos + - staging pull_request: - branches: - - develop - - main - - master - - workos jobs: ci: diff --git a/tests/Feature/Git/TicketKeyReferenceMatcherTest.php b/tests/Feature/Git/TicketKeyReferenceMatcherTest.php index 05cff82..142ceb7 100644 --- a/tests/Feature/Git/TicketKeyReferenceMatcherTest.php +++ b/tests/Feature/Git/TicketKeyReferenceMatcherTest.php @@ -11,9 +11,9 @@ class TicketKeyReferenceMatcherTest extends TestCase use RefreshDatabase; /** - * Ensure a reference must start with the exact ticket key. + * Ensure a reference matches when it contains the ticket key, regardless of case. */ - public function test_matcher_accepts_exact_ticket_key_prefixes(): void + public function test_matcher_accepts_references_containing_the_ticket_key_case_insensitively(): void { $matcher = app(TicketKeyReferenceMatcher::class); @@ -21,17 +21,19 @@ class TicketKeyReferenceMatcherTest extends TestCase $this->assertTrue($matcher->matches('CORE-1', 'CORE-1/fix-oauth')); $this->assertTrue($matcher->matches('CORE-1', 'CORE-1_hotfix')); $this->assertTrue($matcher->matches('CORE-1', 'CORE-1')); + $this->assertTrue($matcher->matches('CORE-1', 'core-1-login-form')); + $this->assertTrue($matcher->matches('CORE-1', 'CORE-10-login-form')); + $this->assertTrue($matcher->matches('CORE-1', 'MY-CORE-1-login-form')); } /** - * Ensure similar ticket keys are not treated as matches. + * Ensure references without the ticket key are not treated as matches. */ - public function test_matcher_rejects_other_ticket_prefixes(): void + public function test_matcher_rejects_references_without_the_ticket_key(): void { $matcher = app(TicketKeyReferenceMatcher::class); - $this->assertFalse($matcher->matches('CORE-1', 'CORE-10-login-form')); - $this->assertFalse($matcher->matches('CORE-1', 'MY-CORE-1-login-form')); - $this->assertFalse($matcher->matches('CORE-1', 'core-1-login-form')); + $this->assertFalse($matcher->matches('CORE-1', 'CORE-2-login-form')); + $this->assertFalse($matcher->matches('CORE-1', 'feature/auth-cleanup')); } } diff --git a/tests/Feature/Models/BoardColumnTest.php b/tests/Feature/Models/BoardColumnTest.php index d201930..1b2eb0e 100644 --- a/tests/Feature/Models/BoardColumnTest.php +++ b/tests/Feature/Models/BoardColumnTest.php @@ -54,7 +54,7 @@ class BoardColumnTest extends TestCase } /** - * Ensure board columns expose tickets ordered by descending sequence number. + * Ensure board columns expose tickets ordered by ascending sequence number. */ public function test_board_column_tickets_are_returned_in_sequence_order(): void { @@ -98,7 +98,7 @@ class BoardColumnTest extends TestCase ]); $this->assertSame( - ['CORE-2', 'CORE-1'], + ['CORE-1', 'CORE-2'], $boardColumn->fresh()->tickets->pluck('ticket_key')->all(), ); } diff --git a/tests/Feature/Projects/ProjectTicketControllerTest.php b/tests/Feature/Projects/ProjectTicketControllerTest.php index 285fa95..b586ccf 100644 --- a/tests/Feature/Projects/ProjectTicketControllerTest.php +++ b/tests/Feature/Projects/ProjectTicketControllerTest.php @@ -338,18 +338,21 @@ class ProjectTicketControllerTest extends TestCase ->component('projects/Ticket') ->where('suggestedBranchName', 'core-1-branch-detail-test') ->where('repositoryBranches.0.repository_connection.repository_full_name', 'core-team/kanbangit') - ->has('repositoryBranches.0.branches', 2) + ->has('repositoryBranches.0.branches', 3) ->where('repositoryBranches.0.branches.0.name', 'CORE-1-login-form') ->where('repositoryBranches.0.branches.1.name', 'CORE-1/fix-oauth') + ->where('repositoryBranches.0.branches.2.name', 'CORE-10-should-not-match') ->where('repositoryBranches.1.repository_connection.repository_full_name', 'other-team/mobile') ->where('repositoryBranches.1.repository_connection.has_personal_access', false) ->where('repositoryBranches.1.branches', []) - ->has('repositoryPullRequests.0.pull_requests', 2) + ->has('repositoryPullRequests.0.pull_requests', 3) ->where('repositoryPullRequests.0.pull_requests.0.number', '42') ->where('repositoryPullRequests.0.pull_requests.0.title', 'Add login form') ->where('repositoryPullRequests.0.pull_requests.0.status', 'open') ->where('repositoryPullRequests.0.pull_requests.1.number', '43') ->where('repositoryPullRequests.0.pull_requests.1.status', 'merged') + ->where('repositoryPullRequests.0.pull_requests.2.number', '99') + ->where('repositoryPullRequests.0.pull_requests.2.status', 'open') ->where('repositoryPullRequests.1.repository_connection.repository_full_name', 'other-team/mobile') ->where('repositoryPullRequests.1.repository_connection.has_personal_access', false) ->where('repositoryPullRequests.1.pull_requests', []),