Add ticket-driven branch creation flow
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Git;
|
||||
|
||||
use App\Actions\Git\TicketKeyReferenceMatcher;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TicketKeyReferenceMatcherTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* Ensure a reference must start with the exact ticket key.
|
||||
*/
|
||||
public function test_matcher_accepts_exact_ticket_key_prefixes(): void
|
||||
{
|
||||
$matcher = app(TicketKeyReferenceMatcher::class);
|
||||
|
||||
$this->assertTrue($matcher->matches('CORE-1', 'CORE-1-login-form'));
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure similar ticket keys are not treated as matches.
|
||||
*/
|
||||
public function test_matcher_rejects_other_ticket_prefixes(): 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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user