mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 16:32:09 +00:00
feat: some fixes to the ui, imlemented user and guest user, ans used the dahboard
This commit is contained in:
@@ -33,6 +33,8 @@ function createVotingRoom(): array
|
||||
|
||||
test('a participant can vote and change their vote in the current round', function () {
|
||||
[$room, $moderator] = createVotingRoom();
|
||||
$room->update(['last_activity_at' => now()->subDay()]);
|
||||
$previousActivity = $room->last_activity_at;
|
||||
|
||||
$session = ["room_players.{$room->id}" => $moderator->id];
|
||||
|
||||
@@ -52,7 +54,8 @@ test('a participant can vote and change their vote in the current round', functi
|
||||
->assertRedirect();
|
||||
|
||||
expect(Vote::query()->count())->toBe(1);
|
||||
expect(Vote::query()->value('value'))->toBe('8');
|
||||
expect(Vote::query()->value('value'))->toBe('8')
|
||||
->and($room->fresh()->last_activity_at->greaterThan($previousActivity))->toBeTrue();
|
||||
});
|
||||
|
||||
test('a participant cannot vote with a card outside the room deck', function () {
|
||||
@@ -67,6 +70,8 @@ test('a participant cannot vote with a card outside the room deck', function ()
|
||||
|
||||
test('other votes stay hidden until the moderator reveals the round', function () {
|
||||
[$room, $moderator, $player] = createVotingRoom();
|
||||
$room->update(['last_activity_at' => now()->subDay()]);
|
||||
$previousActivity = $room->last_activity_at;
|
||||
|
||||
$player->votes()->create([
|
||||
'room_id' => $room->id,
|
||||
@@ -88,6 +93,8 @@ test('other votes stay hidden until the moderator reveals the round', function (
|
||||
->post(route('room.reveal', $room))
|
||||
->assertRedirect();
|
||||
|
||||
expect($room->fresh()->last_activity_at->greaterThan($previousActivity))->toBeTrue();
|
||||
|
||||
$this->withSession($session)
|
||||
->get(route('room.show', $room))
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
@@ -108,7 +115,11 @@ test('only the moderator may reveal cards', function () {
|
||||
test('starting the next round clears the revealed state', function () {
|
||||
[$room, $moderator] = createVotingRoom();
|
||||
|
||||
$room->update(['revealed_at' => now()]);
|
||||
$room->update([
|
||||
'revealed_at' => now(),
|
||||
'last_activity_at' => now()->subDay(),
|
||||
]);
|
||||
$previousActivity = $room->last_activity_at;
|
||||
|
||||
$this->withSession(["room_players.{$room->id}" => $moderator->id])
|
||||
->post(route('room.next-round', $room))
|
||||
@@ -117,7 +128,8 @@ test('starting the next round clears the revealed state', function () {
|
||||
$room->refresh();
|
||||
|
||||
expect($room->current_round)->toBe(2)
|
||||
->and($room->revealed_at)->toBeNull();
|
||||
->and($room->revealed_at)->toBeNull()
|
||||
->and($room->last_activity_at->greaterThan($previousActivity))->toBeTrue();
|
||||
});
|
||||
|
||||
test('the moderator can reset only the votes from the current round', function () {
|
||||
@@ -126,7 +138,9 @@ test('the moderator can reset only the votes from the current round', function (
|
||||
$room->update([
|
||||
'current_round' => 2,
|
||||
'revealed_at' => now(),
|
||||
'last_activity_at' => now()->subDay(),
|
||||
]);
|
||||
$previousActivity = $room->last_activity_at;
|
||||
|
||||
$player->votes()->create([
|
||||
'room_id' => $room->id,
|
||||
@@ -156,5 +170,41 @@ test('the moderator can reset only the votes from the current round', function (
|
||||
'round' => 2,
|
||||
]);
|
||||
|
||||
expect($room->fresh()->revealed_at)->toBeNull();
|
||||
$room->refresh();
|
||||
|
||||
expect($room->revealed_at)->toBeNull()
|
||||
->and($room->last_activity_at->greaterThan($previousActivity))->toBeTrue();
|
||||
});
|
||||
|
||||
test('revealed rounds show the average and median of numeric votes', function () {
|
||||
[$room, $moderator, $player] = createVotingRoom();
|
||||
$thirdPlayer = $room->players()->create([
|
||||
'name' => 'Nina',
|
||||
'is_moderator' => false,
|
||||
]);
|
||||
$nonNumericPlayer = $room->players()->create([
|
||||
'name' => 'Coffee',
|
||||
'is_moderator' => false,
|
||||
]);
|
||||
|
||||
foreach ([
|
||||
[$moderator, '3'],
|
||||
[$player, '5'],
|
||||
[$thirdPlayer, '8'],
|
||||
[$nonNumericPlayer, 'coffee'],
|
||||
] as [$votingPlayer, $value]) {
|
||||
$votingPlayer->votes()->create([
|
||||
'room_id' => $room->id,
|
||||
'round' => 1,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
$room->update(['revealed_at' => now()]);
|
||||
|
||||
$this->withSession(["room_players.{$room->id}" => $moderator->id])
|
||||
->get(route('room.show', $room))
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('room.statistics.average', '5,33')
|
||||
->where('room.statistics.median', '5,00'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user