Restrict preparation document links to their tender scope

This commit is contained in:
2026-09-06 10:17:14 +03:00
parent 91451b1134
commit 2b9e1953e4
5 changed files with 51 additions and 12 deletions
+18 -1
View File
@@ -19,7 +19,7 @@ test('changed requirement and changed product row require new checks',()=>{
});
test('linked file must exist, match reviewed metadata and remain valid at tender deadline',()=>{
const file={id:'f1',olusturma:'2026-09-01',boyut:100,son_kullanma:'2026-09-10',erisilebilir:true};
const file={id:'f1',tur:'firma',olusturma:'2026-09-01',boyut:100,son_kullanma:'2026-09-10',erisilebilir:true};
const c={documentId:file.id,documentRevision:documentRevision(file)};
assert.equal(documentLinkProblem(c,[file],'2026-09-10'),null);
assert.ok(documentLinkProblem(c,[],'2026-09-10'));
@@ -29,3 +29,20 @@ test('linked file must exist, match reviewed metadata and remain valid at tender
const invalid={...file,son_kullanma:'2026-02-31'};
assert.ok(documentLinkProblem({...c,documentRevision:documentRevision(invalid)},[invalid],'2026-01-01'));
});
test('another tender document cannot satisfy preparation but company documents remain reusable',()=>{
const file={id:'doc1',tur:'ihale',ikn:'2026/111',olusturma:'2026-09-01',boyut:20};
const check={documentId:file.id,documentRevision:documentRevision(file)};
assert.match(documentLinkProblem(check,[file],'2026-09-10','2026/222'),/mevcut ihaleye bağlı değil/);
assert.equal(documentLinkProblem(check,[file],'2026-09-10','2026/111'),null);
const company={...file,tur:'firma',ikn:null};
assert.equal(documentLinkProblem({...check,documentRevision:documentRevision(company)},[company],'2026-09-10','2026/222'),null);
const c=complete();c.documents[documentKey(docs[0])]={...c.documents[documentKey(docs[0])],...check};
assert.ok(preparationBlockers(rows,docs,c,{documents:[file],deadlineDate:'2026-09-10',tenderIkn:'2026/222'}).some(e=>e.includes('mevcut ihaleye bağlı değil')));
});
test('classification or tender-link changes invalidate the previous review',()=>{
const file={id:'doc1',tur:'firma',ikn:null,olusturma:'2026-09-01',boyut:20};
const check={documentId:file.id,documentRevision:documentRevision(file)};
assert.match(documentLinkProblem(check,[{...file,tur:'ihale',ikn:'2026/111'}],'2026-09-10','2026/111'),/yeniden seçip/);
assert.match(documentLinkProblem(check,[{...file,tur:undefined}],'2026-09-10','2026/111'),/Belge türü/);
});