test overdue dashboard assignments
This commit is contained in:
parent
2c38b01562
commit
7bc7ad207b
3 changed files with 42 additions and 26 deletions
|
|
@ -225,7 +225,7 @@ class ScheduleEndpointTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function test_it_lists_the_users_assignments_for_a_date(): void
|
||||
public function test_it_lists_the_users_assignments_due_through_a_date(): void
|
||||
{
|
||||
$user = $this->createUser('reader@example.com');
|
||||
$otherUser = $this->createUser('other@example.com');
|
||||
|
|
@ -255,8 +255,8 @@ class ScheduleEndpointTest extends TestCase
|
|||
$this->credentialedPost('/api/schedules', [
|
||||
'setId' => $olderSet->getId(),
|
||||
'levelId' => $olderLevel->getId(),
|
||||
'startDate' => '2026-08-15',
|
||||
'targetDate' => '2026-08-15',
|
||||
'startDate' => '2026-08-14',
|
||||
'targetDate' => '2026-08-14',
|
||||
])->assertCreated();
|
||||
$this->credentialedPost('/api/schedules', [
|
||||
'setId' => $newerSet->getId(),
|
||||
|
|
@ -286,22 +286,9 @@ class ScheduleEndpointTest extends TestCase
|
|||
->assertExactJson([
|
||||
'date' => '2026-08-15',
|
||||
'assignments' => [
|
||||
[
|
||||
'id' => 3,
|
||||
'schedule' => [
|
||||
'id' => 2,
|
||||
'set' => [
|
||||
'name' => 'Newer course',
|
||||
],
|
||||
],
|
||||
'element' => [
|
||||
'name' => 'Only chapter',
|
||||
'kind' => 'chapter',
|
||||
'path' => ['Only chapter'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 1,
|
||||
'scheduledDate' => '2026-08-14',
|
||||
'schedule' => [
|
||||
'id' => 1,
|
||||
'set' => [
|
||||
|
|
@ -316,6 +303,7 @@ class ScheduleEndpointTest extends TestCase
|
|||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'scheduledDate' => '2026-08-14',
|
||||
'schedule' => [
|
||||
'id' => 1,
|
||||
'set' => [
|
||||
|
|
@ -328,6 +316,21 @@ class ScheduleEndpointTest extends TestCase
|
|||
'path' => ['Second lesson'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 3,
|
||||
'scheduledDate' => '2026-08-15',
|
||||
'schedule' => [
|
||||
'id' => 2,
|
||||
'set' => [
|
||||
'name' => 'Newer course',
|
||||
],
|
||||
],
|
||||
'element' => [
|
||||
'name' => 'Only chapter',
|
||||
'kind' => 'chapter',
|
||||
'path' => ['Only chapter'],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Tests\Fakes\FakeScheduleRepository;
|
|||
|
||||
class ListAssignmentsForDateTest extends TestCase
|
||||
{
|
||||
public function test_it_lists_the_users_assignments_for_the_date(): void
|
||||
public function test_it_lists_the_users_assignments_due_through_the_date(): void
|
||||
{
|
||||
$user = $this->user(1, 'reader@example.com');
|
||||
$otherUser = $this->user(2, 'other@example.com');
|
||||
|
|
@ -25,7 +25,7 @@ class ListAssignmentsForDateTest extends TestCase
|
|||
$olderSchedule = $repository->create($this->schedule(
|
||||
user: $user,
|
||||
setName: 'Older plan',
|
||||
date: '2026-08-15',
|
||||
date: '2026-08-14',
|
||||
assignmentNames: ['First', 'Second'],
|
||||
));
|
||||
$repository->create($this->schedule(
|
||||
|
|
@ -37,7 +37,7 @@ class ListAssignmentsForDateTest extends TestCase
|
|||
$repository->create($this->schedule(
|
||||
user: $otherUser,
|
||||
setName: 'Private plan',
|
||||
date: '2026-08-15',
|
||||
date: '2026-08-13',
|
||||
assignmentNames: ['Hidden'],
|
||||
));
|
||||
$repository->create($this->schedule(
|
||||
|
|
@ -61,18 +61,18 @@ class ListAssignmentsForDateTest extends TestCase
|
|||
);
|
||||
|
||||
$this->assertSame(
|
||||
['Newer plan', 'Older plan'],
|
||||
['Older plan', 'Newer plan'],
|
||||
array_map(function ($assignment): string {
|
||||
return $assignment->getSetName();
|
||||
}, $assignments),
|
||||
);
|
||||
$this->assertSame(
|
||||
['Third', 'Second'],
|
||||
['Second', 'Third'],
|
||||
array_map(function ($assignment): string {
|
||||
return $assignment->getAssignment()->getName();
|
||||
}, $assignments),
|
||||
);
|
||||
$this->assertSame(2, $assignments[0]->getScheduleId());
|
||||
$this->assertSame(1, $assignments[0]->getScheduleId());
|
||||
}
|
||||
|
||||
public function test_it_rejects_a_missing_date(): void
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ describe("today's assignments", () => {
|
|||
assignments: [
|
||||
{
|
||||
id: 12,
|
||||
scheduledDate: '2026-08-13',
|
||||
schedule: {
|
||||
id: 73,
|
||||
set: { name: 'Bible' },
|
||||
|
|
@ -48,6 +49,7 @@ describe("today's assignments", () => {
|
|||
},
|
||||
{
|
||||
id: 13,
|
||||
scheduledDate: browserToday,
|
||||
schedule: {
|
||||
id: 81,
|
||||
set: { name: 'Course' },
|
||||
|
|
@ -77,6 +79,16 @@ describe("today's assignments", () => {
|
|||
'have.length',
|
||||
2,
|
||||
)
|
||||
cy.get('[data-today-assignment]')
|
||||
.first()
|
||||
.should('have.attr', 'data-today-assignment', '12')
|
||||
cy.get('[data-today-assignment="12"] .today-assignment__overdue').should(
|
||||
'have.text',
|
||||
'Overdue · Due Aug 13, 2026',
|
||||
)
|
||||
cy.get('[data-today-assignment="13"] .today-assignment__overdue').should(
|
||||
'not.exist',
|
||||
)
|
||||
cy.contains('a', 'Genesis / Creation / Chapter 1')
|
||||
.should('contain.text', 'Bible')
|
||||
.and('have.attr', 'href', '/schedules/73')
|
||||
|
|
@ -109,7 +121,7 @@ describe("today's assignments", () => {
|
|||
|
||||
cy.get('.today-assignments [role="status"]').should(
|
||||
'contain.text',
|
||||
'Nothing is assigned for today.',
|
||||
'Nothing is due today.',
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -121,6 +133,7 @@ describe("today's assignments", () => {
|
|||
assignments: [
|
||||
{
|
||||
id: 12,
|
||||
scheduledDate: browserToday,
|
||||
schedule: {
|
||||
id: 73,
|
||||
set: { name: 'Bible' },
|
||||
|
|
@ -177,7 +190,7 @@ describe("today's assignments", () => {
|
|||
cy.get('[data-today-assignment="12"]').should('not.exist')
|
||||
cy.get('.today-assignments [role="status"]').should(
|
||||
'contain.text',
|
||||
'Nothing is assigned for today.',
|
||||
'Nothing is due today.',
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -219,7 +232,7 @@ describe("today's assignments", () => {
|
|||
|
||||
cy.get('.today-assignments [role="status"]').should(
|
||||
'contain.text',
|
||||
'Nothing is assigned for today.',
|
||||
'Nothing is due today.',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue