test preserved schedule start
This commit is contained in:
parent
db6b41ee42
commit
bcbc2e6ba3
3 changed files with 20 additions and 15 deletions
|
|
@ -558,7 +558,7 @@ class ScheduleEndpointTest extends TestCase
|
|||
->assertJsonCount(2, 'assignments');
|
||||
}
|
||||
|
||||
public function test_it_reschedules_only_unfinished_assignments(): void
|
||||
public function test_it_reschedules_only_unfinished_assignments_without_changing_start_date(): void
|
||||
{
|
||||
$user = $this->createUser('reader@example.com');
|
||||
$set = $this->createSet($user, 'Course');
|
||||
|
|
@ -594,23 +594,24 @@ class ScheduleEndpointTest extends TestCase
|
|||
]);
|
||||
|
||||
$response->assertOk()
|
||||
->assertJsonPath('schedule.startDate', '2026-08-20')
|
||||
->assertJsonPath('schedule.startDate', '2026-08-10')
|
||||
->assertJsonPath('schedule.targetDate', '2026-08-21')
|
||||
->assertJsonCount(12, 'schedule.days')
|
||||
->assertJsonPath('schedule.days.0.date', '2026-08-10')
|
||||
->assertJsonPath(
|
||||
'schedule.days.0.assignments.0.completedAt',
|
||||
'2026-08-15T12:30:45+00:00',
|
||||
)
|
||||
->assertJsonPath('schedule.days.1.date', '2026-08-20')
|
||||
->assertJsonCount(1, 'schedule.days.1.assignments')
|
||||
->assertJsonPath('schedule.days.1.assignments.0.id', 2)
|
||||
->assertJsonPath('schedule.days.2.date', '2026-08-21')
|
||||
->assertJsonCount(2, 'schedule.days.2.assignments')
|
||||
->assertJsonPath('schedule.days.2.assignments.0.id', 3)
|
||||
->assertJsonPath('schedule.days.2.assignments.1.id', 4);
|
||||
->assertJsonPath('schedule.days.10.date', '2026-08-20')
|
||||
->assertJsonCount(1, 'schedule.days.10.assignments')
|
||||
->assertJsonPath('schedule.days.10.assignments.0.id', 2)
|
||||
->assertJsonPath('schedule.days.11.date', '2026-08-21')
|
||||
->assertJsonCount(2, 'schedule.days.11.assignments')
|
||||
->assertJsonPath('schedule.days.11.assignments.0.id', 3)
|
||||
->assertJsonPath('schedule.days.11.assignments.1.id', 4);
|
||||
$this->assertDatabaseHas('schedules', [
|
||||
'id' => 1,
|
||||
'start_date' => '2026-08-20',
|
||||
'start_date' => '2026-08-10',
|
||||
'target_date' => '2026-08-21',
|
||||
]);
|
||||
$this->assertDatabaseHas('schedule_assignments', [
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use Tests\Fakes\FakeScheduleRepository;
|
|||
|
||||
class RescheduleScheduleTest extends TestCase
|
||||
{
|
||||
public function test_it_redistributes_only_unfinished_assignments(): void
|
||||
public function test_it_redistributes_only_unfinished_assignments_without_changing_start_date(): void
|
||||
{
|
||||
$user = $this->user(1, 'reader@example.com');
|
||||
$repository = new FakeScheduleRepository;
|
||||
|
|
@ -42,7 +42,7 @@ class RescheduleScheduleTest extends TestCase
|
|||
),
|
||||
);
|
||||
|
||||
$this->assertSame('2026-08-20', $rescheduled->getStartDate()
|
||||
$this->assertSame('2026-08-10', $rescheduled->getStartDate()
|
||||
->format('Y-m-d'));
|
||||
$this->assertSame('2026-08-21', $rescheduled->getTargetDate()
|
||||
->format('Y-m-d'));
|
||||
|
|
|
|||
|
|
@ -249,10 +249,14 @@ const rescheduleSourceDetail = {
|
|||
const rescheduledDetail = {
|
||||
schedule: {
|
||||
...rescheduleSourceDetail.schedule,
|
||||
startDate: '2026-08-15',
|
||||
startDate: '2026-08-10',
|
||||
targetDate: '2026-08-16',
|
||||
days: [
|
||||
rescheduleSourceDetail.schedule.days[0],
|
||||
{ date: '2026-08-11', assignments: [] },
|
||||
{ date: '2026-08-12', assignments: [] },
|
||||
{ date: '2026-08-13', assignments: [] },
|
||||
{ date: '2026-08-14', assignments: [] },
|
||||
{
|
||||
date: '2026-08-15',
|
||||
assignments: [rescheduleSourceDetail.schedule.days[1]?.assignments[0]],
|
||||
|
|
@ -599,8 +603,8 @@ describe('set scheduling', () => {
|
|||
'have.text',
|
||||
'3 remaining assignments rescheduled.',
|
||||
)
|
||||
cy.contains('4 Chapter_sections-v2 assignments across 2 days').should('be.visible')
|
||||
cy.get('.schedule-range').should('contain.text', 'Aug 15, 2026 to Aug 16, 2026')
|
||||
cy.contains('4 Chapter_sections-v2 assignments across 7 days').should('be.visible')
|
||||
cy.get('.schedule-range').should('contain.text', 'Aug 10, 2026 to Aug 16, 2026')
|
||||
cy.get('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => {
|
||||
expect([...$days].map((day) => day.getAttribute('data-schedule-date'))).to.deep.equal([
|
||||
'2026-08-15',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue