Skip to content

Commit

Permalink
fix sitemap just needed to treat it as dto
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 7, 2024
1 parent b24232b commit 8b33b02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/Domains/Sources/SiteMapSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public function handle(Source $source): void

foreach ($feedItems as $feedItem) {
$webResponseDto = WebResponseDto::from([
'url' => $feedItem['link'],
'title' => $feedItem['title'],
'description' => $feedItem['description'],
'meta_data' => $feedItem,
'url' => $feedItem->link,
'title' => $feedItem->title,
'description' => $feedItem->description,
'meta_data' => $feedItem->toArray(),
'profile' => [],
]);
$jobs[] = new GetWebContentJob($source, $webResponseDto);
Expand Down
8 changes: 7 additions & 1 deletion tests/Feature/SiteMapSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Tests\Feature;

use App\Domains\Sources\FeedSource\FeedItemDto;
use App\Domains\Sources\SourceTypeEnum;
use App\Models\Source;
use Facades\App\Domains\Sources\SiteMapSource\SiteMapParserWrapper;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Bus;
use Tests\TestCase;

Expand All @@ -17,9 +19,13 @@ public function test_run()

$data = get_fixture('sitemap_parsed_results.json');

$item = Arr::first($data);

$item = FeedItemDto::from($item);

SiteMapParserWrapper::shouldReceive('handle')
->once()->andReturn(
collect($data)
collect([$item])
);

$source = Source::factory()->create([
Expand Down

0 comments on commit 8b33b02

Please sign in to comment.