Expand blog to 36 mirrored posts with deepened sections and page-turn links
Deploy Backend / deploy (push) Successful in 2m35s
Deploy Backend / deploy (push) Successful in 2m35s
- Six new topic pairs (EN+FA): TypeScript advanced patterns, SQL indexes, Git branching/reviews, TDD, clean architecture in Laravel, browser page load - Every existing post gains Key takeaways + FAQ sections in both languages - New engineering-practices category pair and database/git/testing tag pairs - Single-post API now returns same-language previous_post/next_post links
This commit is contained in:
1 parent
d659c5d325
commit
fbacb0c9a1
4 files changed
+1377
-9
No files matched your search
@@ -28,7 +28,30 @@ class PostTest extends TestCase
|
||||
$response = $this->getJson("/api/blog/posts/{$post->slug}");
|
||||
|
||||
$response->assertStatus(200)
|
||||
->assertJsonStructure(['post', 'related_posts']);
|
||||
->assertJsonStructure(['post', 'related_posts', 'previous_post', 'next_post']);
|
||||
}
|
||||
|
||||
public function test_page_turn_links_stay_inside_the_reader_language()
|
||||
{
|
||||
Post::factory()->create(['slug' => 'older-topic', 'published_at' => now()->subDays(2)]);
|
||||
Post::factory()->create(['slug' => 'older-topic-fa', 'published_at' => now()->subDays(2)]);
|
||||
Post::factory()->create(['slug' => 'newer-topic', 'published_at' => now()->addDay()]);
|
||||
Post::factory()->create(['slug' => 'newer-topic-fa', 'published_at' => now()->addDay()]);
|
||||
$current = Post::factory()->create(['slug' => 'current-topic', 'published_at' => now()]);
|
||||
$currentFa = Post::factory()->create(['slug' => 'current-topic-fa', 'published_at' => now()]);
|
||||
|
||||
$response = $this->getJson("/api/blog/posts/{$current->slug}");
|
||||
|
||||
$response->assertStatus(200)
|
||||
->assertJsonPath('previous_post.slug', 'newer-topic')
|
||||
->assertJsonPath('next_post.slug', 'older-topic')
|
||||
->assertJsonMissing(['previous_post' => ['slug' => 'newer-topic-fa']]);
|
||||
|
||||
$response = $this->getJson("/api/blog/posts/{$currentFa->slug}");
|
||||
|
||||
$response->assertStatus(200)
|
||||
->assertJsonPath('previous_post.slug', 'newer-topic-fa')
|
||||
->assertJsonPath('next_post.slug', 'older-topic-fa');
|
||||
}
|
||||
|
||||
public function test_can_create_post()
|
||||
|
||||
Reference in new issue
Block a user