Fix acceptance criteria toggle ajax responses
This commit is contained in:
@@ -661,6 +661,52 @@ class ProjectTicketControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_ticket_update_returns_json_for_ajax_requests(): void
|
||||
{
|
||||
$editor = User::factory()->create();
|
||||
$project = Project::factory()->create([
|
||||
'key' => 'CORE',
|
||||
]);
|
||||
|
||||
app(InitializeProjectTicketMetadata::class)->handle($project);
|
||||
|
||||
$priority = $project->ticketPriorities()->firstOrFail();
|
||||
$ticketType = $this->nonParentType($project);
|
||||
$ticket = Ticket::factory()->create([
|
||||
'project_id' => $project->id,
|
||||
'sequence_number' => 1,
|
||||
'ticket_key' => 'CORE-1',
|
||||
'ticket_priority_id' => $priority->id,
|
||||
'ticket_type_id' => $ticketType->id,
|
||||
'title' => 'Acceptance criteria toggle test',
|
||||
]);
|
||||
|
||||
$this->syncProjectPermissions($project, $editor, ['write', 'view']);
|
||||
|
||||
$this->actingAs($editor)
|
||||
->withHeaders([
|
||||
'Accept' => 'application/json',
|
||||
'X-Requested-With' => 'XMLHttpRequest',
|
||||
])
|
||||
->patch(route('projects.tickets.update', [$project, $ticket]), [
|
||||
'acceptance_criteria' => [],
|
||||
'blocked_comment' => $ticket->blocked_comment,
|
||||
'description' => $ticket->description,
|
||||
'field_values' => [],
|
||||
'is_blocked' => $ticket->is_blocked,
|
||||
'parent_ticket_id' => $ticket->parent_ticket_id,
|
||||
'story_points' => $ticket->story_points,
|
||||
'ticket_priority_id' => $priority->id,
|
||||
'ticket_type_id' => $ticketType->id,
|
||||
'title' => $ticket->title,
|
||||
])
|
||||
->assertOk()
|
||||
->assertJson([
|
||||
'message' => 'No ticket changes were detected.',
|
||||
'updated' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure non-parent tickets cannot be assigned as a parent target.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user