@@ -5,6 +5,7 @@ import { create, type ReactTestRenderer } from "react-test-renderer";
55import { describe , expect , it , vi } from "vite-plus/test" ;
66
77import { getSyntaxHighlighterPromise } from "../lib/syntaxHighlighting" ;
8+ import { GitHubIcon } from "./Icons" ;
89import { Button } from "./ui/button" ;
910import { setMarkdownTaskChecked } from "./files/filePreviewMode" ;
1011
@@ -79,10 +80,10 @@ describe("ChatMarkdown favicon privacy", () => {
7980 const markdown = ( url : string ) => < ChatMarkdown cwd = "/tmp/project" text = { `[Link](${ url } )` } /> ;
8081 try {
8182 await act ( async ( ) => {
82- renderer = create ( markdown ( "https://github .com" ) ) ;
83+ renderer = create ( markdown ( "https://example .com" ) ) ;
8384 } ) ;
8485 expect ( renderer ! . root . findAllByType ( "img" ) . map ( ( image ) => image . props . src ) ) . toEqual ( [
85- "https://www.google.com/s2/favicons?domain=github .com&sz=32" ,
86+ "https://www.google.com/s2/favicons?domain=example .com&sz=32" ,
8687 ] ) ;
8788 for ( const url of [ "http://192.168.1.10:8080" , "http://localhost:3000" , "http://home.arpa" ] ) {
8889 await act ( async ( ) => {
@@ -91,9 +92,15 @@ describe("ChatMarkdown favicon privacy", () => {
9192 expect ( renderer ! . root . findAllByType ( "img" ) ) . toHaveLength ( 0 ) ;
9293 }
9394 await act ( async ( ) => {
94- renderer ! . update ( markdown ( "https://github .com" ) ) ;
95+ renderer ! . update ( markdown ( "https://example .com" ) ) ;
9596 } ) ;
9697 expect ( renderer ! . root . findAllByType ( "img" ) ) . toHaveLength ( 1 ) ;
98+ // GitHub links draw the brand mark in currentColor instead of fetching a favicon.
99+ await act ( async ( ) => {
100+ renderer ! . update ( markdown ( "https://github.com/pingdotgg/t3code/pull/1" ) ) ;
101+ } ) ;
102+ expect ( renderer ! . root . findAllByType ( "img" ) ) . toHaveLength ( 0 ) ;
103+ expect ( renderer ! . root . findAllByType ( GitHubIcon ) ) . toHaveLength ( 1 ) ;
97104 } finally {
98105 await act ( async ( ) => {
99106 renderer ?. unmount ( ) ;
0 commit comments