Tets for BonusScoreController

This commit is contained in:
Matt Young 2025-07-15 09:56:34 -05:00
parent 27e68ab233
commit 0af15bf753
1 changed files with 34 additions and 0 deletions

View File

@ -201,4 +201,38 @@ describe('BonusScoreController::saveEntryBonusScoreSheet', function () {
expect(BonusScore::all())->toHaveCount(0); expect(BonusScore::all())->toHaveCount(0);
}); });
it('passes exceptions from the enter bonus score action', function () {
$ASbonusScoreRecorded = BonusScore::create([
'entry_id' => $this->ASentry->id,
'user_id' => $this->judge1->id,
'originally_scored_entry' => $this->ASentry->id,
'score' => 2,
]);
$TSbonusScoreRecorded = BonusScore::create([
'entry_id' => $this->TSentry->id,
'user_id' => $this->judge1->id,
'originally_scored_entry' => $this->ASentry->id,
'score' => 2,
]);
$BSbonusScoreRecorded = BonusScore::create([
'entry_id' => $this->BSentry->id,
'user_id' => $this->judge1->id,
'originally_scored_entry' => $this->ASentry->id,
'score' => 2,
]);
actAsAdmin();
$response = $this->post(route('bonus-scores.saveEntryBonusScoreSheet', $this->TSentry), [
'judge_id' => $this->judge1->id,
'entry_id' => $this->TSentry->id,
'score' => 908556,
]);
$response->assertRedirect(route('bonus-scores.entryBonusScoreSheet', ['entry_id' => $this->TSentry->id]))
->assertSessionHas('error');
foreach (Entry::all() as $entry) {
$bs = $entry->bonusScores()->first();
expect($bs->score)->toEqual(2)
->and($bs->originallyScoredEntry->id)->toEqual($this->ASentry->id);
}
});
}); });