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 = {
schedule: {
...scheduleDetail.schedule,
startDate: '2026-08-09',
targetDate: '2026-08-13',
assignmentCount: 4,
days: [
{ date: '2026-08-09', assignments: [] },
scheduleDetail.schedule.days[0],
scheduleDetail.schedule.days[1],
{
@ -298,6 +300,7 @@ describe('set scheduling', () => {
})
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', {
statusCode: 200,
body: bibleLayout,
@ -518,6 +521,7 @@ describe('set scheduling', () => {
cy.get('[data-schedule-date="2026-08-10"]')
.should('contain.text', 'Overdue')
.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"]')
.should('contain.text', 'Rest day')
.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('[data-assignment-section="remaining"] [data-schedule-day]').then(($days) => {
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-16',
])
@ -689,6 +689,7 @@ describe('set scheduling', () => {
it('completes and reopens assignments from the schedule', () => {
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', {
statusCode: 200,
body: completedScheduleDetail,
@ -733,7 +734,7 @@ describe('set scheduling', () => {
cy.get('[data-assignment-section="remaining"]')
.should('have.attr', 'data-assignment-count', '0')
.and('contain.text', 'All assignments are complete.')
.and('contain.text', 'Rest day')
.and('not.contain.text', 'Rest day')
cy.get('[data-assignment-section="completed"]')
.should('have.attr', 'data-assignment-count', '2')
.within(() => {