@@ -38,7 +38,7 @@ describe.each([
3838 scriptFunctionName : 'useScriptGoogleAnalytics' ,
3939 use : ( ) => { } ,
4040 stub : ( ) => { } ,
41- } ) ) . toThrowError ( 'no main script found for google-analytics in third-party-capital' )
41+ } ) ) . rejects . toThrow ( 'no main script found for google-analytics in third-party-capital' )
4242 } )
4343
4444 describe ( 'script content generation' , ( ) => {
@@ -68,8 +68,8 @@ describe.each([
6868 } ,
6969 }
7070
71- it ( `expect to${ isDev ? '' : ' not' } add the schema to the script options` , ( ) => {
72- const result = getTpcScriptContent ( input )
71+ it ( `expect to${ isDev ? '' : ' not' } add the schema to the script options` , async ( ) => {
72+ const result = await getTpcScriptContent ( input )
7373 const returnStatement = getTpcScriptReturnStatement ( result , 'useScriptGoogleAnalytics' )
7474 if ( ! returnStatement || returnStatement . argument ?. type !== TSESTree . AST_NODE_TYPES . CallExpression || ( returnStatement . argument ?. callee as TSESTree . Identifier ) . name !== 'useRegistryScript' ) {
7575 throw new Error ( 'TPC Scripts must return a call expression of useRegistryScript' )
@@ -92,8 +92,8 @@ describe.each([
9292 }
9393 } )
9494
95- it ( 'expect to stringify the use and stub functions' , ( ) => {
96- const result = getTpcScriptContent ( input )
95+ it ( 'expect to stringify the use and stub functions' , async ( ) => {
96+ const result = await getTpcScriptContent ( input )
9797 const returnStatement = getTpcScriptReturnStatement ( result , 'useScriptGoogleAnalytics' )
9898 if ( ! returnStatement || returnStatement . argument ?. type !== TSESTree . AST_NODE_TYPES . CallExpression || ( returnStatement . argument ?. callee as TSESTree . Identifier ) . name !== 'useRegistryScript' ) {
9999 throw new Error ( 'TPC Scripts must return a call expression of useRegistryScript' )
@@ -111,8 +111,8 @@ describe.each([
111111 expect ( getCodeFromAst ( result , stubFn ) ) . toContain ( 'return []' )
112112 } )
113113
114- it ( 'expect to augment window types' , ( ) => {
115- const result = getTpcScriptContent ( input )
114+ it ( 'expect to augment window types' , async ( ) => {
115+ const result = await getTpcScriptContent ( input )
116116 const ast = parse ( result , { loc : true , range : true } )
117117 const augmentWindowTypes = ast . body . find ( ( node ) : node is TSESTree . TSModuleDeclaration => node . type === TSESTree . AST_NODE_TYPES . TSModuleDeclaration )
118118 expect ( augmentWindowTypes ) . toBeTruthy ( )
@@ -145,12 +145,12 @@ describe('script content generation with head positioning', () => {
145145 }
146146
147147 describe ( 'main script' , ( ) => {
148- it ( 'main script post body position' , ( ) => {
149- const scriptOptsAst = getTpcScriptOptsASt ( getTpcScriptContent ( inputBase ) , 'useScriptGoogleAnalytics' )
150- expect ( getCodeFromAst ( getTpcScriptContent ( inputBase ) , scriptOptsAst ) ) . toContain ( '"tagPosition":"bodyClose"' )
148+ it ( 'main script post body position' , async ( ) => {
149+ const scriptOptsAst = getTpcScriptOptsASt ( await getTpcScriptContent ( inputBase ) , 'useScriptGoogleAnalytics' )
150+ expect ( getCodeFromAst ( await getTpcScriptContent ( inputBase ) , scriptOptsAst ) ) . toContain ( '"tagPosition":"bodyClose"' )
151151 } )
152- it ( 'main script pre body position' , ( ) => {
153- const scriptOptsAst = getTpcScriptOptsASt ( getTpcScriptContent ( {
152+ it ( 'main script pre body position' , async ( ) => {
153+ const scriptOptsAst = getTpcScriptOptsASt ( await getTpcScriptContent ( {
154154 ...inputBase ,
155155 data : {
156156 ...inputBase . data ,
@@ -160,7 +160,7 @@ describe('script content generation with head positioning', () => {
160160 } ] ,
161161 } ,
162162 } ) , 'useScriptGoogleAnalytics' )
163- expect ( getCodeFromAst ( getTpcScriptContent ( inputBase ) , scriptOptsAst ) ) . toContain ( '"tagPosition":"bodyClose"' )
163+ expect ( getCodeFromAst ( await getTpcScriptContent ( inputBase ) , scriptOptsAst ) ) . toContain ( '"tagPosition":"bodyClose"' )
164164 } )
165165 } )
166166} )
0 commit comments