Simplify acceptance criteria checklist model
This commit is contained in:
@@ -44,18 +44,15 @@ class TicketApiTest extends TestCase
|
||||
$createResponse = $this->withApplicationKey($user)
|
||||
->postJson(route('api.projects.tickets.store', $project), [
|
||||
'acceptance_criteria' => [
|
||||
'summary' => 'Can sign in',
|
||||
'items' => [
|
||||
[
|
||||
'checked' => false,
|
||||
'indent' => 0,
|
||||
'text' => 'Credentials are validated',
|
||||
],
|
||||
[
|
||||
'checked' => true,
|
||||
'indent' => 1,
|
||||
'text' => 'Nested validation is supported',
|
||||
],
|
||||
[
|
||||
'checked' => false,
|
||||
'indent' => 0,
|
||||
'text' => 'Credentials are validated',
|
||||
],
|
||||
[
|
||||
'checked' => true,
|
||||
'indent' => 1,
|
||||
'text' => 'Nested validation is supported',
|
||||
],
|
||||
],
|
||||
'description' => 'Build the API-created ticket',
|
||||
@@ -67,8 +64,7 @@ class TicketApiTest extends TestCase
|
||||
])
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.ticket_key', 'CORE-1')
|
||||
->assertJsonPath('data.acceptance_criteria.summary', 'Can sign in')
|
||||
->assertJsonPath('data.acceptance_criteria.items.1.indent', 1)
|
||||
->assertJsonPath('data.acceptance_criteria.1.indent', 1)
|
||||
->assertJsonPath('meta.message', 'CORE-1 was created.');
|
||||
|
||||
$ticket = Ticket::query()->findOrFail($createResponse->json('data.id'));
|
||||
@@ -81,13 +77,10 @@ class TicketApiTest extends TestCase
|
||||
$this->withApplicationKey($user)
|
||||
->patchJson(route('api.projects.tickets.update', [$project, $ticket]), [
|
||||
'acceptance_criteria' => [
|
||||
'summary' => 'Can sign in from the API',
|
||||
'items' => [
|
||||
[
|
||||
'checked' => true,
|
||||
'indent' => 0,
|
||||
'text' => 'API update preserves checked state',
|
||||
],
|
||||
[
|
||||
'checked' => true,
|
||||
'indent' => 0,
|
||||
'text' => 'API update preserves checked state',
|
||||
],
|
||||
],
|
||||
'blocked_comment' => null,
|
||||
@@ -101,7 +94,7 @@ class TicketApiTest extends TestCase
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('data.title', 'Updated API ticket')
|
||||
->assertJsonPath('data.acceptance_criteria.items.0.checked', true)
|
||||
->assertJsonPath('data.acceptance_criteria.0.checked', true)
|
||||
->assertJsonPath('meta.message', 'CORE-1 was updated.');
|
||||
|
||||
$this->withApplicationKey($user)
|
||||
|
||||
@@ -110,7 +110,7 @@ class TicketCreatedNotificationDispatchTest extends TestCase
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
->post(route('projects.tickets.store', $project), [
|
||||
'acceptance_criteria' => 'Ship it.',
|
||||
'acceptance_criteria' => '- [ ] Ship it.',
|
||||
'assignee_user_id' => null,
|
||||
'description' => 'Created from notification dispatch test.',
|
||||
'story_points' => 3,
|
||||
|
||||
@@ -84,7 +84,7 @@ class ProjectBacklogTest extends TestCase
|
||||
->post(route('projects.tickets.store', $project), [
|
||||
'title' => 'New ticket',
|
||||
'description' => 'Description',
|
||||
'acceptance_criteria' => 'Criteria',
|
||||
'acceptance_criteria' => '- [ ] Criteria',
|
||||
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
|
||||
'ticket_priority_id' => $priority->id,
|
||||
'ticket_status_id' => $backlogStatus->id,
|
||||
@@ -118,7 +118,7 @@ class ProjectBacklogTest extends TestCase
|
||||
$payload = [
|
||||
'title' => 'Same title',
|
||||
'description' => 'Description',
|
||||
'acceptance_criteria' => 'Criteria',
|
||||
'acceptance_criteria' => '- [ ] Criteria',
|
||||
'assignee_user_id' => $assignee->id,
|
||||
'story_points' => 3,
|
||||
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
|
||||
@@ -192,7 +192,7 @@ class ProjectBacklogTest extends TestCase
|
||||
->post(route('projects.tickets.store', $project), [
|
||||
'title' => 'New ticket',
|
||||
'description' => 'Description',
|
||||
'acceptance_criteria' => 'Criteria',
|
||||
'acceptance_criteria' => '- [ ] Criteria',
|
||||
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
|
||||
'ticket_priority_id' => $project->ticketPriorities()->firstOrFail()->id,
|
||||
'ticket_status_id' => $boardStatus->id,
|
||||
|
||||
@@ -56,7 +56,7 @@ class ProjectTicketControllerTest extends TestCase
|
||||
'position' => 1,
|
||||
]);
|
||||
|
||||
$legacyAcceptanceCriteria = "Review checklist\n- [ ] User can sign in\n - [x] Nested verification";
|
||||
$legacyAcceptanceCriteria = "- [ ] User can sign in\n - [x] Nested verification";
|
||||
|
||||
$ticket = Ticket::factory()->create([
|
||||
'acceptance_criteria' => $legacyAcceptanceCriteria,
|
||||
@@ -110,14 +110,12 @@ class ProjectTicketControllerTest extends TestCase
|
||||
->where('project.show_author', false)
|
||||
->where('ticket.ticket_key', 'CORE-1')
|
||||
->where('ticket.story_points', 5)
|
||||
->where('ticket.acceptance_criteria.summary', 'Review checklist')
|
||||
->where('ticket.acceptance_criteria.items.0.text', 'User can sign in')
|
||||
->where('ticket.acceptance_criteria.items.0.checked', false)
|
||||
->where('ticket.acceptance_criteria.items.0.indent', 0)
|
||||
->where('ticket.acceptance_criteria.items.1.text', 'Nested verification')
|
||||
->where('ticket.acceptance_criteria.items.1.checked', true)
|
||||
->where('ticket.acceptance_criteria.items.1.indent', 1)
|
||||
->where('ticket.acceptance_criteria_text', $legacyAcceptanceCriteria)
|
||||
->where('ticket.acceptance_criteria.0.text', 'User can sign in')
|
||||
->where('ticket.acceptance_criteria.0.checked', false)
|
||||
->where('ticket.acceptance_criteria.0.indent', 0)
|
||||
->where('ticket.acceptance_criteria.1.text', 'Nested verification')
|
||||
->where('ticket.acceptance_criteria.1.checked', true)
|
||||
->where('ticket.acceptance_criteria.1.indent', 1)
|
||||
->where('ticket.assignee.name', 'Assigned User')
|
||||
->where('ticket.author', null)
|
||||
->where('ticket.author_user_id', null)
|
||||
@@ -350,7 +348,7 @@ class ProjectTicketControllerTest extends TestCase
|
||||
|
||||
$this->actingAs($editor)
|
||||
->post(route('projects.tickets.store', $project), [
|
||||
'acceptance_criteria' => 'The ticket exists.',
|
||||
'acceptance_criteria' => '- [ ] The ticket exists.',
|
||||
'assignee_user_id' => $assignee->id,
|
||||
'description' => 'Created from the dedicated page.',
|
||||
'story_points' => 5,
|
||||
@@ -448,7 +446,7 @@ class ProjectTicketControllerTest extends TestCase
|
||||
]);
|
||||
|
||||
$ticket = Ticket::factory()->create([
|
||||
'acceptance_criteria' => 'Old acceptance criteria',
|
||||
'acceptance_criteria' => '- [ ] Old acceptance criteria',
|
||||
'author_user_id' => $author->id,
|
||||
'description' => 'Old description',
|
||||
'project_id' => $project->id,
|
||||
@@ -475,18 +473,15 @@ class ProjectTicketControllerTest extends TestCase
|
||||
$this->syncProjectPermissions($project, $editor, ['write', 'view']);
|
||||
|
||||
$updatedAcceptanceCriteria = [
|
||||
'summary' => 'Updated acceptance criteria',
|
||||
'items' => [
|
||||
[
|
||||
'text' => 'Shows success banner',
|
||||
'checked' => false,
|
||||
'indent' => 0,
|
||||
],
|
||||
[
|
||||
'text' => 'Includes nested confirmations',
|
||||
'checked' => true,
|
||||
'indent' => 1,
|
||||
],
|
||||
[
|
||||
'text' => 'Shows success banner',
|
||||
'checked' => false,
|
||||
'indent' => 0,
|
||||
],
|
||||
[
|
||||
'text' => 'Includes nested confirmations',
|
||||
'checked' => true,
|
||||
'indent' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -520,7 +515,7 @@ class ProjectTicketControllerTest extends TestCase
|
||||
'id' => $ticket->id,
|
||||
'title' => 'Updated title',
|
||||
'description' => 'Updated description',
|
||||
'acceptance_criteria' => "Updated acceptance criteria\n\n- [ ] Shows success banner\n - [x] Includes nested confirmations",
|
||||
'acceptance_criteria' => "- [ ] Shows success banner\n - [x] Includes nested confirmations",
|
||||
'assignee_user_id' => $assignee->id,
|
||||
'story_points' => 8,
|
||||
'ticket_type_id' => $this->parentType($project)->id,
|
||||
@@ -531,7 +526,7 @@ class ProjectTicketControllerTest extends TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
$updatedAcceptanceCriteria,
|
||||
\App\Actions\Tickets\Support\TicketAcceptanceCriteriaData::fromModels(
|
||||
\App\Actions\Tickets\Support\AcceptanceCriteriaChecklist::fromModels(
|
||||
$ticket->acceptanceCriteria,
|
||||
$ticket->acceptance_criteria,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user