Skip to content

Commit 0ecf8ac

Browse files
committed
feat: Add PageVersion test
1 parent 8a26154 commit 0ecf8ac

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Feature/PageControllerTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,20 @@
4343
$response->assertCreated()->assertJsonStructure(['data' => ['id', 'title', 'slug', 'content', 'author_id']]);
4444
$response->assertJsonPath('data.author_id', $user->id);
4545
});
46+
47+
test('update page', function () {
48+
$user = User::factory()->create();
49+
50+
$response = $this->asUser($user)->putJson('/api/page/1', [
51+
'title' => 'new title',
52+
'content' => 'new content',
53+
'author_id' => $user->id,
54+
'slug' => 'newslug',
55+
]);
56+
57+
$response->assertCreated()->assertJsonStructure(['data' => ['id', 'title', 'slug', 'content', 'author_id']]);
58+
$response->assertJsonPath('data.author_id', $user->id);
59+
$this->assertDatabaseHas('page_version', [
60+
'page_id' => 1,
61+
]);
62+
});

0 commit comments

Comments
 (0)