Use health portfolio in explained tender matching

This commit is contained in:
2026-09-06 13:35:09 +03:00
parent 8e37b200e9
commit 65efd981c5
3 changed files with 32 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {profilTerimleri,profilMetni,havuzuPuanla} from '../src/services/uyum.js';
const profile={scrapedCapabilities:{healthPortfolio:[{group:'Mikroskop',brand:'QA marka',model:'M200',utsStatus:'declared',utsReference:'KAYIT123',serviceCapacity:'5 teknisyen'}]}};
test('portfolio-only profile produces explained product matches without treating UTS declaration as proof',()=>{
const terms=profilTerimleri(profile);
assert.ok(terms.some(t=>t.terim==='mikroskop'&&t.kaynak==='portföy ürün grubu'));
assert.ok(!terms.some(t=>t.terim.includes('kayit123')||t.terim.includes('teknisyen')||t.terim.includes('declared')));
const rows=havuzuPuanla([{id:'yes',baslik:'Mikroskop alımı'},{id:'no',baslik:'Akaryakıt alımı'}],profile);
assert.ok(rows[0].aiMatchScore>0);assert.equal(rows[0].uyumNedenleri[0].kaynak,'portföy ürün grubu');assert.equal(rows[1].aiMatchScore,0);
assert.match(profilMetni(profile),/Firma portföyü \(beyan\): Mikroskop QA marka M200/);
});
test('matching finds a portfolio product beyond the old 3000-character announcement cutoff',()=>{
const [row]=havuzuPuanla([{id:'long',baslik:'Malzeme alımı',aciklama:'açıklama '.repeat(500)+'Mikroskop teslim edilecektir.'}],profile);
assert.ok(row.aiMatchScore>0);assert.equal(row.uyumNedenleri[0].alan,'ilan metni');
});
test('same product in manual list and portfolio is not scored twice; removed portfolio leaves no invented score',()=>{
const merged={scrapedCapabilities:{...profile.scrapedCapabilities,extractedProducts:['MİKROSKOP']}};
assert.equal(profilTerimleri(merged).filter(t=>t.terim==='mikroskop').length,1);
assert.equal(havuzuPuanla([{id:'old',baslik:'Mikroskop',aiMatchScore:90}],{scrapedCapabilities:{healthPortfolio:[]}})[0].aiMatchScore,null);
});