@@ -44,47 +44,53 @@ describe('pages', () => {
4444 } ) ;
4545 for ( const categoryExtensions of [ true , false ] ) {
4646 it ( `list pages ${ categoryExtensions ? 'with' : 'without' } --category-extensions` , async ( ) => {
47- await withMcpContext ( async ( response , context ) => {
48- await installExtension . handler (
49- { params : { path : EXTENSION_PATH } } ,
50- response ,
51- context ,
52- ) ;
47+ await withMcpContext (
48+ async ( response , context ) => {
49+ await installExtension . handler (
50+ { params : { path : EXTENSION_PATH } } ,
51+ response ,
52+ context ,
53+ ) ;
5354
54- const swTarget = await context . browser . waitForTarget (
55- t =>
56- t . type ( ) === 'service_worker' &&
57- t . url ( ) . includes ( 'chrome-extension://' ) ,
58- ) ;
59- const swUrl = swTarget . url ( ) ;
55+ const swTarget = await context . browser . waitForTarget (
56+ t =>
57+ t . type ( ) === 'service_worker' &&
58+ t . url ( ) . includes ( 'chrome-extension://' ) ,
59+ ) ;
60+ const swUrl = swTarget . url ( ) ;
6061
61- response . resetResponseLineForTesting ( ) ;
62+ response . resetResponseLineForTesting ( ) ;
6263
63- const listPageDef = listPages ( {
64- categoryExtensions,
65- } as ParsedArguments ) ;
66- await listPageDef . handler ( { params : { } } , response , context ) ;
67-
68- const result = await response . handle ( listPageDef . name , context ) ;
69- const textContent = result . content . find ( c => c . type === 'text' ) as {
70- type : 'text' ;
71- text : string ;
72- } ;
73- assert . ok ( textContent ) ;
74-
75- if ( categoryExtensions ) {
76- assert . ok ( textContent . text . includes ( swUrl ) ) ;
77- const structured = result . structuredContent as {
78- extensionServiceWorkers : Array < { url : string } > ;
64+ const listPageDef = listPages ( {
65+ categoryExtensions,
66+ } as ParsedArguments ) ;
67+ await listPageDef . handler ( { params : { } } , response , context ) ;
68+
69+ const result = await response . handle ( listPageDef . name , context ) ;
70+ const textContent = result . content . find ( c => c . type === 'text' ) as {
71+ type : 'text' ;
72+ text : string ;
7973 } ;
80- assert . deepStrictEqual (
81- structured . extensionServiceWorkers . map ( sw => sw . url ) ,
82- [ swUrl ] ,
83- ) ;
84- } else {
85- assert . ok ( ! textContent . text . includes ( swUrl ) ) ;
86- }
87- } ) ;
74+ assert . ok ( textContent ) ;
75+
76+ if ( categoryExtensions ) {
77+ assert . ok ( textContent . text . includes ( swUrl ) ) ;
78+ const structured = result . structuredContent as {
79+ extensionServiceWorkers : Array < { url : string } > ;
80+ } ;
81+ assert . deepStrictEqual (
82+ structured . extensionServiceWorkers . map ( sw => sw . url ) ,
83+ [ swUrl ] ,
84+ ) ;
85+ } else {
86+ assert . ok ( ! textContent . text . includes ( swUrl ) ) ;
87+ }
88+ } ,
89+ { } ,
90+ {
91+ categoryExtensions,
92+ } as ParsedArguments ,
93+ ) ;
8894 } ) ;
8995 }
9096 } ) ;
0 commit comments