withoutMiddleware([ VerifyCsrfToken::class, \Illuminate\Session\Middleware\AuthenticateSession::class, ]); } // ─── Comment component ──────────────────────────── public function test_comment_header_uses_singular_count_for_one_comment(): void { [$user, $video] = $this->makeUserAndVideo(); Comment::create([ 'user_id' => $user->id, 'video_id' => $video->id, 'body' => 'the only comment', ]); $this->actingAs($user); $html = view('components.video-comments', ['video' => $video])->render(); $this->assertStringContainsString('1 Comment', $html); $this->assertStringNotContainsString('1 Comments', $html); } public function test_comment_header_breaks_out_replies_from_top_level(): void { [$user, $video] = $this->makeUserAndVideo(); $parent = Comment::create([ 'user_id' => $user->id, 'video_id' => $video->id, 'body' => 'top', ]); Comment::create([ 'user_id' => $user->id, 'video_id' => $video->id, 'parent_id' => $parent->id, 'body' => 'reply 1', ]); Comment::create([ 'user_id' => $user->id, 'video_id' => $video->id, 'parent_id' => $parent->id, 'body' => 'reply 2', ]); $this->actingAs($user); $html = view('components.video-comments', ['video' => $video])->render(); $this->assertStringContainsString('1 Comment', $html, 'Top-level count is 1.'); $this->assertStringContainsString('2 replies', $html, 'Replies are counted separately.'); } public function test_each_comment_timestamp_is_a_lc_permalink(): void { [$user, $video] = $this->makeUserAndVideo(); $c = Comment::create([ 'user_id' => $user->id, 'video_id' => $video->id, 'body' => 'hi', ]); $this->actingAs($user); $html = view('components.video-comments', ['video' => $video])->render(); $this->assertStringContainsString('?lc=' . $c->id . '#comment-' . $c->id, $html); $this->assertStringContainsString('ytc-permalink', $html); } // ─── Description markdown ──────────────────────── public function test_leaked_markdown_headers_render_as_html(): void { $out = HtmlSanitizer::render("Intro line\n## Letra\nla la\n### Chorus"); $this->assertStringContainsString('