test past rest day filtering

This commit is contained in:
Yisroel Baum 2026-08-22 22:56:40 +03:00
parent d2002eccb9
commit 9c604e9455
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -138,9 +138,11 @@ const completedScheduleDetail = {
const splitScheduleDetail = { const splitScheduleDetail = {
schedule: { schedule: {
...scheduleDetail.schedule, ...scheduleDetail.schedule,
startDate: '2026-08-09',
targetDate: '2026-08-13', targetDate: '2026-08-13',
assignmentCount: 4, assignmentCount: 4,
days: [ days: [
{ date: '2026-08-09', assignments: [] },
scheduleDetail.schedule.days[0], scheduleDetail.schedule.days[0],
scheduleDetail.schedule.days[1], scheduleDetail.schedule.days[1],
{ {
@ -298,6 +300,7 @@ describe('set scheduling', () => {
}) })
it('creates a schedule from a set and shows every day', () => { it('creates a schedule from a set and shows every day', () => {
cy.clock(new Date(2026, 7, 10, 12).getTime(), ['Date'])
cy.intercept('GET', '**/api/sets/41', { cy.intercept('GET', '**/api/sets/41', {
statusCode: 200, statusCode: 200,
body: bibleLayout, body: bibleLayout,
@ -518,6 +521,7 @@ describe('set scheduling', () => {
cy.get('[data-schedule-date="2026-08-10"]') cy.get('[data-schedule-date="2026-08-10"]')
.should('contain.text', 'Overdue') .should('contain.text', 'Overdue')
.and('contain.text', 'Genesis / Creation / Chapter 1') .and('contain.text', 'Genesis / Creation / Chapter 1')
cy.get('[data-schedule-date="2026-08-09"]').should('not.exist')
cy.get('[data-schedule-date="2026-08-11"]') cy.get('[data-schedule-date="2026-08-11"]')
.should('contain.text', 'Rest day') .should('contain.text', 'Rest day')
.and('not.contain.text', 'Overdue') .and('not.contain.text', 'Overdue')
@ -607,10 +611,6 @@ describe('set scheduling', () => {
cy.get('.schedule-range').should('contain.text', 'Aug 10, 2026 to Aug 16, 2026') 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) => { cy.get('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => {
expect([...$days].map((day) => day.getAttribute('data-schedule-date'))).to.deep.equal([ expect([...$days].map((day) => day.getAttribute('data-schedule-date'))).to.deep.equal([
'2026-08-11',
'2026-08-12',
'2026-08-13',
'2026-08-14',
'2026-08-15', '2026-08-15',
'2026-08-16', '2026-08-16',
]) ])
@ -689,6 +689,7 @@ describe('set scheduling', () => {
it('completes and reopens assignments from the schedule', () => { it('completes and reopens assignments from the schedule', () => {
const completedAt = '2026-08-15T12:30:00+00:00' const completedAt = '2026-08-15T12:30:00+00:00'
cy.clock(new Date(2026, 7, 15, 12).getTime(), ['Date'])
cy.intercept('GET', '**/api/schedules/73', { cy.intercept('GET', '**/api/schedules/73', {
statusCode: 200, statusCode: 200,
body: completedScheduleDetail, body: completedScheduleDetail,
@ -733,7 +734,7 @@ describe('set scheduling', () => {
cy.get('[data-assignment-section="remaining"]') cy.get('[data-assignment-section="remaining"]')
.should('have.attr', 'data-assignment-count', '0') .should('have.attr', 'data-assignment-count', '0')
.and('contain.text', 'All assignments are complete.') .and('contain.text', 'All assignments are complete.')
.and('contain.text', 'Rest day') .and('not.contain.text', 'Rest day')
cy.get('[data-assignment-section="completed"]') cy.get('[data-assignment-section="completed"]')
.should('have.attr', 'data-assignment-count', '2') .should('have.attr', 'data-assignment-count', '2')
.within(() => { .within(() => {