6d48503a0e
Stage 1: опознавалка фирмы по сайту/карточкам, ProposalClassifier new/actualize/archived/hidden, box=archived, bulk удалить всех ранее удалённых. Backend 249/249, front autopodbor 61/61. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Services\Autopodbor\AutopodborNormalizer;
|
|
use App\Services\Autopodbor\CompetitorIdentity;
|
|
|
|
function identity(): CompetitorIdentity
|
|
{
|
|
return new CompetitorIdentity(new AutopodborNormalizer);
|
|
}
|
|
|
|
it('ключ сайта — голова домена (точный домен, без www/пути)', function () {
|
|
expect(identity()->keys(['site_url' => 'https://www.Yarich.RU/contacts', 'directory_urls' => []]))
|
|
->toBe(['s:yarich.ru']);
|
|
});
|
|
|
|
it('ключ карточки 2ГИС — firm id; Яндекс — slug', function () {
|
|
$keys = identity()->keys([
|
|
'site_url' => null,
|
|
'directory_urls' => [
|
|
'https://2gis.ru/krasnoyarsk/firm/985690700540003',
|
|
'https://yandex.ru/maps/org/yarich/175852236692',
|
|
],
|
|
]);
|
|
expect($keys)->toContain('d:2gis:985690700540003')->toContain('d:ya:yarich');
|
|
});
|
|
|
|
it('имя НЕ участвует; без опознавалок — пусто', function () {
|
|
expect(identity()->keys(['name' => 'Любое Имя', 'site_url' => null, 'directory_urls' => []]))
|
|
->toBe([]);
|
|
});
|
|
|
|
it('пересечение опознавалок = та же фирма (сайт сменился, карточка та же)', function () {
|
|
$a = identity()->keys(['site_url' => 'yarich.ru', 'directory_urls' => ['https://2gis.ru/x/firm/111']]);
|
|
$b = identity()->keys(['site_url' => 'yarich-new.ru', 'directory_urls' => ['https://2gis.ru/y/firm/111']]);
|
|
expect(array_values(array_intersect($a, $b)))->toBe(['d:2gis:111']);
|
|
});
|