Expose suggested branch name in ticket responses
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources;
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use App\Actions\Git\BuildSuggestedTicketBranchName;
|
||||||
use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper;
|
use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
@@ -53,6 +54,7 @@ class TicketResource extends JsonResource
|
|||||||
'project_id' => $this->project_id,
|
'project_id' => $this->project_id,
|
||||||
'sequence_number' => $this->sequence_number,
|
'sequence_number' => $this->sequence_number,
|
||||||
'story_points' => $this->story_points,
|
'story_points' => $this->story_points,
|
||||||
|
'suggested_branch_name' => app(BuildSuggestedTicketBranchName::class)->handle($this->resource),
|
||||||
'ticket_key' => $this->ticket_key,
|
'ticket_key' => $this->ticket_key,
|
||||||
'ticket_priority' => $this->whenLoaded(
|
'ticket_priority' => $this->whenLoaded(
|
||||||
'ticketPriority',
|
'ticketPriority',
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class TicketApiTest extends TestCase
|
|||||||
->assertCreated()
|
->assertCreated()
|
||||||
->assertJsonPath('data.ticket_key', 'CORE-1')
|
->assertJsonPath('data.ticket_key', 'CORE-1')
|
||||||
->assertJsonPath('data.acceptance_criteria.1.indent', 1)
|
->assertJsonPath('data.acceptance_criteria.1.indent', 1)
|
||||||
|
->assertJsonPath('data.suggested_branch_name', 'core-1-api-ticket')
|
||||||
->assertJsonPath('meta.message', 'CORE-1 was created.');
|
->assertJsonPath('meta.message', 'CORE-1 was created.');
|
||||||
|
|
||||||
$ticket = Ticket::query()->findOrFail($createResponse->json('data.id'));
|
$ticket = Ticket::query()->findOrFail($createResponse->json('data.id'));
|
||||||
@@ -101,7 +102,9 @@ class TicketApiTest extends TestCase
|
|||||||
->getJson(route('api.projects.tickets.show', [$project, $ticket]))
|
->getJson(route('api.projects.tickets.show', [$project, $ticket]))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertJsonPath('data.ticket.ticket_key', 'CORE-1')
|
->assertJsonPath('data.ticket.ticket_key', 'CORE-1')
|
||||||
->assertJsonPath('data.ticket.story_points', 5);
|
->assertJsonPath('data.ticket.story_points', 5)
|
||||||
|
->assertJsonPath('data.ticket.suggested_branch_name', 'core-1-updated-api-ticket')
|
||||||
|
->assertJsonPath('data.suggestedBranchName', 'core-1-updated-api-ticket');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_ticket_update_hides_author_for_non_admins_when_author_visibility_is_disabled(): void
|
public function test_ticket_update_hides_author_for_non_admins_when_author_visibility_is_disabled(): void
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ class KanbanGitMcpTest extends TestCase
|
|||||||
->where('data.project.name', 'Core project')
|
->where('data.project.name', 'Core project')
|
||||||
->where('data.ticket.ticket_key', 'CORE-1')
|
->where('data.ticket.ticket_key', 'CORE-1')
|
||||||
->where('data.ticket.description', 'Detailed MCP description')
|
->where('data.ticket.description', 'Detailed MCP description')
|
||||||
|
->where('data.ticket.suggested_branch_name', 'core-1-detailed-ticket')
|
||||||
->etc());
|
->etc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user