import { describe, it } from 'node:test'; import assert from 'node:assert/strict'; import { formatClassDays, formatClassTime, formatClassSchedule, calculateClassEndDate } from './classSchedule.js'; describe('class schedule display', () => { it('formats weekdays in Iran week order', () => { assert.equal(formatClassDays([1, 6]), 'شنبه و دوشنبه'); }); it('formats start and end times', () => { assert.equal(formatClassTime('19:00', '21:00'), '19:00 – 21:00'); assert.equal(formatClassTime('19:00', ''), '19:00'); }); it('joins days and time for a class schedule label', () => { assert.equal( formatClassSchedule({ days: [6, 1], startTime: '19:00', endTime: '21:00' }), 'شنبه و دوشنبه | 19:00 – 21:00' ); assert.equal(formatClassSchedule({}), ''); }); it('calculates class end date from start date, days and number of sessions', () => { // 1403/01/01 is Wednesday (day 3) // If days are [6, 2] (Saturday, Tuesday), 2 sessions: // Session 1: Saturday 1403/01/04 // Session 2: Tuesday 1403/01/07 const endDate = calculateClassEndDate('1403/01/01', [6, 2], 2); assert.equal(endDate, '1403/01/07'); }); });