Files
portal/app/tests/Unit/Autopodbor/Extract/SourceAggregatorLiveTest.php
T

22 lines
1.8 KiB
PHP
Raw Normal View History

<?php
use App\Services\Autopodbor\Agent\Extract\SourceAggregator;
it('на данных КрасЛомбарда: справочная сверху, подменный внизу, пул скрыт', function () {
$cand = [
['number' => '73912920000', 'kind' => 'code', 'label' => 'код', 'url' => null, 'office' => 'Единая справочная', 'tracker' => true],
['number' => '73912920000', 'kind' => 'contacts', 'label' => 'контакты', 'url' => null, 'office' => null, 'tracker' => true],
['number' => '73912920000', 'kind' => 'directory', 'label' => '2ГИС', 'url' => 'https://2gis.ru/1', 'office' => null, 'tracker' => true],
['number' => '73912817070', 'kind' => 'code', 'label' => 'код', 'url' => null, 'office' => 'Кр. рабочий, 61', 'tracker' => true],
['number' => '73912500000', 'kind' => 'contacts', 'label' => 'контакты', 'url' => null, 'office' => 'Калинина, 185', 'tracker' => true],
['number' => '79012414545', 'kind' => 'displayed', 'label' => 'Callibri', 'url' => null, 'office' => null, 'tracker' => true],
['number' => '70489624563', 'kind' => 'pool', 'label' => 'пул', 'url' => null, 'office' => null, 'tracker' => true],
];
$out = (new SourceAggregator)->aggregate($cand);
$ids = array_map(fn ($s) => $s->identifier, $out);
expect($ids)->not->toContain('70489624563'); // пул скрыт
expect($ids[0])->toBe('73912920000'); // 3 подтверждения — сверху
expect(end($out)->phoneKind)->toBe('substitute'); // подменный — внизу
});