Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
AmonDeShir committed Dec 14, 2024
1 parent 1f335de commit ca8fb38
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Feature/QuizTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,33 @@ public function testAdminCanViewQuizzes(): void
);
}

public function testLocalQuizHasNoQuestionsVisible(): void
{
$quiz = Quiz::factory()->local()->create();
Question::factory()->count(5)->create(["quiz_id" => $quiz->id]);

$this->actingAs($this->admin)
->get("/admin/quizzes")
->assertInertia(
fn(Assert $page) => $page
->component("Admin/Quizzes")
->has("quizzes.data", 1)
->has("quizzes.data.0.questions", 0),
);

$quiz->is_local = false;
$quiz->save();

$this->actingAs($this->admin)
->get("/admin/quizzes")
->assertInertia(
fn(Assert $page) => $page
->component("Admin/Quizzes")
->has("quizzes.data", 1)
->has("quizzes.data.0.questions", 5),
);
}

public function testUserCanCreateQuiz(): void
{
$this->actingAs($this->admin)
Expand Down

0 comments on commit ca8fb38

Please sign in to comment.