Recheck tender deadlines before preparation output delivery

This commit is contained in:
2026-09-06 10:29:17 +03:00
parent cb231426e8
commit dbe43c241d
5 changed files with 50 additions and 3 deletions
+16
View File
@@ -0,0 +1,16 @@
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ış/);
});