import {test} from 'node:test'; import assert from 'node:assert/strict'; import {preparationDeadlineProblem} from '../src/services/preparationDeadline.js'; const tender={tarih:'10.09.2026',saat:'10:00',durum:'Açık'}; test('readiness closes at the exact Istanbul deadline, including during output generation',()=>{ assert.equal(preparationDeadlineProblem(tender,new Date('2026-09-10T06:59:59.999Z')),null); assert.match(preparationDeadlineProblem(tender,new Date('2026-09-10T07:00:00Z')),/zamanı geçti/); }); test('unknown or malformed deadline cannot qualify as a ready bid',()=>{ for(const value of [{tarih:'31.02.2026',saat:'10:00'},{tarih:'10.09.2026'},{tarih:'10.09.2026abc',saat:'10:00'},{tarih:'10.09.2026',saat:'10:0099'}]) assert.match(preparationDeadlineProblem(value,new Date('2026-09-01')),/doğrulanamadı/); }); test('cancelled and completed tenders do not regain readiness merely through a future date',()=>{ for(const durum of ['İptal Edildi','Sonuçlandı','Sözleşme imzalandı']) assert.match(preparationDeadlineProblem({...tender,durum},new Date('2026-09-01')),/iptal edilmiş veya sonuçlanmış/); });