fix(tickets): show numeric id and remove date column
This commit is contained in:
@@ -70,8 +70,11 @@ class AdminAppTicketControllerTest extends TestCase
|
||||
->assertJsonCount(1, 'data')
|
||||
->assertJsonPath('data.0.id', $ticket->id)
|
||||
->assertJsonPath('data.0.tenant_code', $tenant->codigo)
|
||||
->assertJsonPath('data.0.values.ticket', $ticket->ticket)
|
||||
->assertJsonPath('data.0.values.id', $ticket->id)
|
||||
->assertJsonPath('data.0.values.status', Ticket::STATUS_ACTIVE)
|
||||
->assertJsonMissingPath('data.0.values.ticket')
|
||||
->assertJsonMissingPath('data.0.values.date')
|
||||
->assertJsonMissingPath('data.0.date')
|
||||
->assertJsonPath('meta.total', 1);
|
||||
}
|
||||
|
||||
@@ -96,34 +99,34 @@ class AdminAppTicketControllerTest extends TestCase
|
||||
->assertJsonPath('data.0.ticket', $matching->ticket);
|
||||
}
|
||||
|
||||
public function test_it_sorts_the_complete_filtered_result_before_paginating(): void
|
||||
public function test_it_sorts_by_ticket_id_before_paginating(): void
|
||||
{
|
||||
$tenant = $this->createTenant('fiesta_futbol_infantil');
|
||||
$admin = $this->createAdminAppUser($tenant);
|
||||
$this->grantTicketsMenu($tenant);
|
||||
Sanctum::actingAs($admin);
|
||||
|
||||
foreach (['ticket-c', 'ticket-a', 'ticket-d', 'ticket-b'] as $value) {
|
||||
$this->createTicket($tenant, $admin)->update(['ticket' => $value]);
|
||||
}
|
||||
$ids = collect(range(1, 4))
|
||||
->map(fn (): int => $this->createTicket($tenant, $admin)->id)
|
||||
->all();
|
||||
|
||||
$query = http_build_query([
|
||||
'sort_by' => 'ticket',
|
||||
'sort_by' => 'id',
|
||||
'sort_direction' => 'asc',
|
||||
'per_page' => 2,
|
||||
]);
|
||||
|
||||
$this->getJson('/api/v1/adminapp/tenant/tickets?'.$query)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.0.values.ticket', 'ticket-a')
|
||||
->assertJsonPath('data.1.values.ticket', 'ticket-b')
|
||||
->assertJsonPath('data.0.values.id', $ids[0])
|
||||
->assertJsonPath('data.1.values.id', $ids[1])
|
||||
->assertJsonPath('meta.total', 4)
|
||||
->assertJsonPath('meta.last_page', 2);
|
||||
|
||||
$this->getJson('/api/v1/adminapp/tenant/tickets?'.$query.'&page=2')
|
||||
->assertOk()
|
||||
->assertJsonPath('data.0.values.ticket', 'ticket-c')
|
||||
->assertJsonPath('data.1.values.ticket', 'ticket-d');
|
||||
->assertJsonPath('data.0.values.id', $ids[2])
|
||||
->assertJsonPath('data.1.values.id', $ids[3]);
|
||||
}
|
||||
|
||||
public function test_it_rejects_sort_columns_not_enabled_for_the_tenant(): void
|
||||
|
||||
Reference in New Issue
Block a user