@@ -46,7 +46,7 @@ describe(REGION_TAG, () => {
4646 const bucketName = `translation-${ bucketUuid } /BATCH_TRANSLATE_OUTPUT/` ;
4747 const storage = new Storage ( ) ;
4848
49- ( before ( async ( ) => {
49+ before ( async ( ) => {
5050 const projectId = await translationClient . getProjectId ( ) ;
5151
5252 //Create bucket if needed
@@ -61,32 +61,33 @@ describe(REGION_TAG, () => {
6161 console . error ( error ) ;
6262 }
6363 } ) ;
64- } ) ,
65- it ( 'should batch translate the input text' , async function ( ) {
66- this . retries ( 3 ) ;
67- const projectId = await translationClient . getProjectId ( ) ;
68- await clearBucket ( projectId , storage , bucketUuid ) ;
69- const inputUri = 'gs://cloud-samples-data/translation/text.txt' ;
64+ } ) ;
7065
71- const outputUri = `gs://${ projectId } /${ bucketName } ` ;
72- const output = execSync (
73- `node v3/${ REGION_TAG } .js ${ projectId } ${ location } ${ inputUri } ${ outputUri } `
74- ) ;
75- assert . match ( output , / T o t a l C h a r a c t e r s : 1 3 / ) ;
76- assert . match ( output , / T r a n s l a t e d C h a r a c t e r s : 1 3 / ) ;
77- } ) ,
78- // Delete the folder from GCS for cleanup
79- after ( async ( ) => {
80- const projectId = await translationClient . getProjectId ( ) ;
81- const options = {
82- prefix : `translation-${ bucketUuid } ` ,
83- } ;
66+ it ( 'should batch translate the input text' , async function ( ) {
67+ this . retries ( 3 ) ;
68+ const projectId = await translationClient . getProjectId ( ) ;
69+ await clearBucket ( projectId , storage , bucketUuid ) ;
70+ const inputUri = 'gs://cloud-samples-data/translation/text.txt' ;
71+
72+ const outputUri = `gs://${ projectId } /${ bucketName } ` ;
73+ const output = execSync (
74+ `node v3/${ REGION_TAG } .js ${ projectId } ${ location } ${ inputUri } ${ outputUri } `
75+ ) ;
76+ assert . match ( output , / T o t a l C h a r a c t e r s : 1 3 / ) ;
77+ assert . match ( output , / T r a n s l a t e d C h a r a c t e r s : 1 3 / ) ;
78+ } ) ;
79+ // Delete the folder from GCS for cleanup
80+ after ( async ( ) => {
81+ const projectId = await translationClient . getProjectId ( ) ;
82+ const options = {
83+ prefix : `translation-${ bucketUuid } ` ,
84+ } ;
8485
85- const bucket = await storage . bucket ( projectId ) ;
86- const [ files ] = await bucket . getFiles ( options ) ;
87- const length = files . length ;
88- if ( length > 0 ) {
89- await Promise . all ( files . map ( file => file . delete ( ) ) ) ;
90- }
91- } ) ) ;
86+ const bucket = await storage . bucket ( projectId ) ;
87+ const [ files ] = await bucket . getFiles ( options ) ;
88+ const length = files . length ;
89+ if ( length > 0 ) {
90+ await Promise . all ( files . map ( file => file . delete ( ) ) ) ;
91+ }
92+ } ) ;
9293} ) ;
0 commit comments