@@ -27,24 +27,31 @@ describe('Freestyler', function() {
2727 } ) ;
2828
2929 async function setupMocks (
30- aidaAvailability : Partial < Root . Runtime . AidaAvailability > ,
31- devToolsFreestyler : Partial < Root . Runtime . HostConfigFreestyler > , messages : string [ ] ) {
30+ hostConfig : Root . Runtime . HostConfig ,
31+ messages : string [ ] ,
32+ ) {
3233 const { frontend} = getBrowserAndPages ( ) ;
3334 await frontend . bringToFront ( ) ;
34- // TODO: come up with less invasive way to mock host configs.
35- const { identifier} = await frontend . evaluateOnNewDocument (
36- `globalThis.hostConfigForTesting = {...globalThis.hostConfigForTesting, devToolsFreestyler: ${
37- JSON . stringify ( devToolsFreestyler ) } , aidaAvailability: ${ JSON . stringify ( aidaAvailability ) }
38- };
3935
40- globalThis.getSyncInformationForTesting = () => {
41- return {
36+ const syncInformation = {
4237 accountEmail : 'some-email' ,
4338 isSyncActive : true ,
4439 arePreferencesSynced : false ,
4540 } ;
46- };
47- ` ) ;
41+
42+ // TODO: come up with less invasive way to mock host configs.
43+ const { identifier} = await frontend . evaluateOnNewDocument ( `
44+ globalThis.hostConfigForTesting = {
45+ ...globalThis.hostConfigForTesting ?? {},
46+ ...JSON.parse('${ JSON . stringify ( hostConfig ) } '),
47+ }
48+
49+ console.log(globalThis.hostConfigForTesting);
50+
51+ globalThis.getSyncInformationForTesting = () => {
52+ return JSON.parse('${ JSON . stringify ( syncInformation ) } ');
53+ };
54+ ` ) ;
4855
4956 preloadScriptId = identifier ;
5057 await frontend . reload ( {
@@ -149,7 +156,14 @@ describe('Freestyler', function() {
149156 }
150157
151158 async function runWithMessages ( query : string , messages : string [ ] ) : Promise < Array < Log > > {
152- await setupMocks ( { } , { enabled : true } , messages ) ;
159+ await setupMocks (
160+ {
161+ aidaAvailability : { } ,
162+ devToolsFreestyler : {
163+ enabled : true ,
164+ } ,
165+ } ,
166+ messages ) ;
153167 await goToResource ( '../resources/recorder/recorder.html' ) ;
154168
155169 await inspectNode ( 'div' ) ;
@@ -216,7 +230,7 @@ STOP`,
216230 assert . deepStrictEqual ( result . at ( - 1 ) ! . request . input , 'OBSERVATION: {"aspectRatio":"auto"}' ) ;
217231 } ) ;
218232
219- it ( 'modifes the inline styles using the extension functions' , async ( ) => {
233+ it ( 'modifies the inline styles using the extension functions' , async ( ) => {
220234 await runWithMessages ( 'Change the background color for this element to blue' , [
221235 `THOUGHT: I can change the background color of an element by setting the background-color CSS property.
222236TITLE: changing the property
0 commit comments