fix: block ready bid exports once a winner is published
This commit is contained in:
@@ -14,3 +14,10 @@ test('cancelled and completed tenders do not regain readiness merely through a f
|
||||
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ış/);
|
||||
});
|
||||
|
||||
test('published winner blocks readiness even when the source status and date still appear open',()=>{
|
||||
const now=new Date('2026-09-01');
|
||||
for(const durum of ['Açık','',undefined])
|
||||
assert.match(preparationDeadlineProblem({...tender,durum,kazananFirma:'QA Laboratuvar'},now),/kazananı açıklanmış/);
|
||||
assert.equal(preparationDeadlineProblem({...tender,kazananFirma:''},now),null);
|
||||
});
|
||||
|
||||
@@ -18,3 +18,15 @@ test('unknown legacy fields do not invent a change and a new saved baseline clea
|
||||
const result=applyTenderStates([current],{'2026/2':{snapshot:tenderSnapshot(current),data:{takipte:true}}});
|
||||
assert.deepEqual(result[0].sourceChanges,[]);
|
||||
});
|
||||
|
||||
test('winner publication changes the reviewed bid source without destroying saved prices',()=>{
|
||||
const original={ikn:'2026/winner',tarih:'10.09.2026',saat:'10:00',durum:'Açık'};
|
||||
const draft={pricesBySource:{kit:'100'},reviewedSource:bidSourceSnapshot(original)};
|
||||
const awarded={...original,kazananFirma:'QA Kazanan'};
|
||||
const result=applyTenderStates([awarded],{[original.ikn]:{snapshot:tenderSnapshot(original),data:{bidDraft:draft,takipte:true}}})[0];
|
||||
assert.notEqual(bidSourceSnapshot(result),draft.reviewedSource);
|
||||
assert.deepEqual(result.bidDraft,draft);
|
||||
const restored=applyTenderStates([],{[original.ikn]:{snapshot:tenderSnapshot(awarded),data:{bidDraft:draft,takipte:true}}})[0];
|
||||
assert.equal(restored.kazananFirma,'QA Kazanan');
|
||||
assert.equal(bidSourceSnapshot(original),bidSourceSnapshot({...original,kazananFirma:''}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user