Tets for BonusScoreController
This commit is contained in:
parent
27e68ab233
commit
0af15bf753
|
|
@ -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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue