char-slop/berry
multipurpose self-modifiable agentic harness
git clone https://git.t4t.associates/char-slop/berry
6483d2d
main
1import { assertEquals , assertRejects } from "@std/assert" ; 2import { testExtension } from "@berry/api/testing.ts" ; 3import browser from "./mod.ts" ; 4import type { BrowserViewData , Snapshot } from "./types.ts" ; 5 6Deno . test ( "historical snapshots can be read without reviving a browser" , async () => { 7const snapshot :Snapshot = { 8tab :"t1" , 9url :"https://example.com/" , 10title :"Earlier page" , 11text :"Historical" , 12elements :[], 13truncated :false , 14frames :[], 15diagnostics :[], 16}; 17const ext = testExtension ( browser , { 18events :[{ type :"observed" , version :1 , action :"open" , snapshot, at :100 }], 19}); 20try { 21const data = await ext . request ( "view" , {}) as BrowserViewData ; 22assertEquals ( data . active , false ); 23assertEquals ( data . tabs , [ snapshot ]); 24assertEquals (( await ext . call ( "browser" , { action :"tabs" }) as { tabs :unknown [] }). tabs , []); 25await assertRejects ( 26() => ext . call ( "browser" , { action :"snapshot" , tab :"t1" }), 27Error , 28"No live tab" , 29); 30} finally { 31await ext . dispose (); 32} 33});