chore: commit current workspace changes
This commit is contained in:
59
tests/Feature/Artworks/SimilarArtworksPageTest.php
Normal file
59
tests/Feature/Artworks/SimilarArtworksPageTest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\Category;
|
||||
use App\Models\ContentType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('renders the similar artworks page without duplicate seo head tags', function (): void {
|
||||
$author = User::factory()->create([
|
||||
'username' => 'similarmetaauthor',
|
||||
'name' => 'Similar Meta Author',
|
||||
]);
|
||||
|
||||
$contentType = ContentType::query()->create([
|
||||
'name' => 'Skins',
|
||||
'slug' => 'skins',
|
||||
'description' => 'Skins content type',
|
||||
]);
|
||||
|
||||
$category = Category::query()->create([
|
||||
'content_type_id' => $contentType->id,
|
||||
'name' => 'Internet',
|
||||
'slug' => 'internet',
|
||||
'description' => 'Internet skins',
|
||||
'is_active' => true,
|
||||
'sort_order' => 1,
|
||||
]);
|
||||
|
||||
$artwork = Artwork::factory()->for($author)->create([
|
||||
'title' => 'Similar Head Artwork',
|
||||
'slug' => 'similar-head-artwork',
|
||||
'published_at' => now()->subHour(),
|
||||
'is_public' => true,
|
||||
'is_approved' => true,
|
||||
]);
|
||||
|
||||
$artwork->categories()->attach($category->id);
|
||||
|
||||
$response = $this->get(route('art.similar', ['id' => $artwork->id]));
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$html = $response->getContent();
|
||||
|
||||
expect($html)
|
||||
->toContain('Similar Artworks')
|
||||
->toContain('application/ld+json');
|
||||
|
||||
expect(substr_count($html, '<meta name="description"'))->toBe(1);
|
||||
expect(substr_count($html, '<link rel="canonical"'))->toBe(1);
|
||||
expect(substr_count($html, 'property="og:title"'))->toBe(1);
|
||||
expect(substr_count($html, 'name="twitter:title"'))->toBe(1);
|
||||
expect(substr_count($html, 'name="robots"'))->toBe(1);
|
||||
});
|
||||
Reference in New Issue
Block a user