@@ -10,12 +10,10 @@ import {
1010 lookupFavicon ,
1111 recordFaviconForProject ,
1212 recordFaviconForThread ,
13- registerFaviconProjectForThread ,
1413 resetBrowserFaviconsForTests ,
1514 resolveBrowserFaviconStorage ,
1615 useBrowserFaviconStore ,
1716} from "./browserFaviconStore" ;
18- import { BROWSER_FAVICON_MAX_ENTRIES } from "./browserFaviconLogic" ;
1917
2018const environmentId = EnvironmentId . make ( "env-1" ) ;
2119const projectRef = scopeProjectRef ( environmentId , ProjectId . make ( "project-1" ) ) ;
@@ -69,60 +67,6 @@ describe("browser favicon store", () => {
6967 ) . toBeNull ( ) ;
7068 } ) ;
7169
72- it ( "keeps exact host aliases attached to the newest canonical icon" , ( ) => {
73- const olderPng = "data:image/png;base64,QkJCQg==" ;
74- const newerPng = "data:image/png;base64,Q0NDQw==" ;
75- recordFaviconForProject (
76- projectRef ,
77- favicon ( "http://192.168.64.2:3000/" , 10 , olderPng ) ,
78- "192.168.64.2" ,
79- ) ;
80- recordFaviconForProject (
81- projectRef ,
82- favicon ( "http://192.168.64.3:3000/" , 20 , newerPng ) ,
83- "192.168.64.3" ,
84- ) ;
85- recordFaviconForProject (
86- projectRef ,
87- favicon ( "http://192.168.64.4:3000/" , 15 , olderPng ) ,
88- "192.168.64.4" ,
89- ) ;
90- const byKey = useBrowserFaviconStore . getState ( ) . byKey ;
91- for ( const host of [ "192.168.64.2" , "192.168.64.3" , "192.168.64.4" ] ) {
92- expect ( lookupFavicon ( byKey , projectRef , `http://${ host } :3000/` , null ) ) . toBe ( newerPng ) ;
93- }
94- expect ( byKey [ "env-1:project-1 http://localhost:3000" ] ?. capturedAt ) . toBe ( 20 ) ;
95- } ) ;
96-
97- it ( "evicts an icon and its exact host aliases atomically" , ( ) => {
98- recordFaviconForProject ( projectRef , favicon ( "http://192.168.64.2:3000/" , 100 ) , "192.168.64.2" ) ;
99- for ( let index = 1 ; index < BROWSER_FAVICON_MAX_ENTRIES ; index += 1 ) {
100- recordFaviconForProject (
101- projectRef ,
102- favicon ( `https://example-${ index } .com/` , 100 + index ) ,
103- null ,
104- ) ;
105- }
106- expect (
107- lookupFavicon (
108- useBrowserFaviconStore . getState ( ) . byKey ,
109- projectRef ,
110- "http://192.168.64.2:3000/" ,
111- null ,
112- ) ,
113- ) . toBe ( PNG ) ;
114-
115- recordFaviconForProject ( projectRef , favicon ( "https://evicts-oldest.example/" , 1_000 ) , null ) ;
116- expect (
117- lookupFavicon (
118- useBrowserFaviconStore . getState ( ) . byKey ,
119- projectRef ,
120- "http://192.168.64.2:3000/" ,
121- null ,
122- ) ,
123- ) . toBeNull ( ) ;
124- } ) ;
125-
12670 it ( "retains multiple origins until project and connection metadata hydrate" , ( ) => {
12771 expect (
12872 recordFaviconForThread ( threadRef , favicon ( "http://localhost:3000/" , 1 ) , null , undefined ) ,
@@ -165,22 +109,6 @@ describe("browser favicon store", () => {
165109 expect ( Object . values ( useBrowserFaviconStore . getState ( ) . pendingByThreadKey ) [ 0 ] ) . toBeDefined ( ) ;
166110 } ) ;
167111
168- it ( "flushes and resolves a pending draft-thread favicon after physical project registration" , ( ) => {
169- recordFaviconForThread ( threadRef , favicon ( "http://localhost:8025/" , 10 ) , null , undefined ) ;
170- registerFaviconProjectForThread ( threadRef , projectRef ) ;
171- const registered = useBrowserFaviconStore . getState ( ) . projectRefByThreadKey [ "env-1:thread-1" ] ;
172- expect ( registered ) . toEqual ( projectRef ) ;
173- expect ( flushPendingFaviconsForThread ( threadRef , registered ! , undefined ) ) . toBe ( true ) ;
174- expect (
175- lookupFavicon (
176- useBrowserFaviconStore . getState ( ) . byKey ,
177- registered ! ,
178- "http://localhost:8025/" ,
179- null ,
180- ) ,
181- ) . toBe ( PNG ) ;
182- } ) ;
183-
184112 it ( "keeps the memory shadow authoritative after an asymmetric primary write failure" , ( ) => {
185113 vi . stubGlobal ( "window" , {
186114 localStorage : {
0 commit comments