import test from 'node:test';
import assert from 'node:assert/strict';

import { getChinaWorkdayInfo, isChinaWorkday } from './china-workday-calendar';

test('classifies 2026 official holidays and makeup workdays', () => {
  const nationalDay = getChinaWorkdayInfo('2026-10-01');
  assert.equal(nationalDay.type, 'holiday');
  assert.equal(nationalDay.isWorkday, false);
  assert.equal(nationalDay.label, '国庆节');
  assert.equal(isChinaWorkday('2026-10-01'), false);

  const makeupDay = getChinaWorkdayInfo('2026-10-10');
  assert.equal(makeupDay.type, 'makeup_workday');
  assert.equal(makeupDay.isWorkday, true);
  assert.equal(makeupDay.label, '国庆节调休上班');
  assert.equal(isChinaWorkday('2026-10-10'), true);
});

test('classifies 2026 regular weekends and weekdays', () => {
  assert.equal(getChinaWorkdayInfo('2026-07-04').type, 'weekend');
  assert.equal(getChinaWorkdayInfo('2026-07-04').isWorkday, false);

  assert.equal(getChinaWorkdayInfo('2026-07-06').type, 'workday');
  assert.equal(getChinaWorkdayInfo('2026-07-06').isWorkday, true);
});

test('uses only the date part from local datetime values', () => {
  const dragonBoat = getChinaWorkdayInfo('2026-06-19T09:30');
  assert.equal(dragonBoat.type, 'holiday');
  assert.equal(dragonBoat.label, '端午节');
});
