From ec42669969398e9d82760a485d79905c9bc28414 Mon Sep 17 00:00:00 2001 From: aribray <45905583+aribray@users.noreply.github.com> Date: Sat, 23 Oct 2021 09:42:17 -0700 Subject: [PATCH] test: replace 'after' hook with 'afterEach' to ensure directory deletion (#737) * fix: replace 'after' hook with 'afterEach' to delete bucket before each retry Change-Id: Ia9323762e3c68916217fc734df1df485c9b0e83c * fix: replace 'after' hook with 'afterEach' for translate text beta and translate text with model Change-Id: Ic32bea9ea1ef93e622f76b5d45bae2a62f577532 --- .../test/v3/translate_batch_translate_text_with_model.test.js | 4 ++-- .../test/v3beta1/translate_batch_translate_document.test.js | 4 ++-- .../test/v3beta1/translate_batch_translate_text_beta.test.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/translate/test/v3/translate_batch_translate_text_with_model.test.js b/translate/test/v3/translate_batch_translate_text_with_model.test.js index 817efe36d87..e6715dce3c6 100644 --- a/translate/test/v3/translate_batch_translate_text_with_model.test.js +++ b/translate/test/v3/translate_batch_translate_text_with_model.test.js @@ -15,7 +15,7 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, before, after} = require('mocha'); +const {describe, it, before, afterEach} = require('mocha'); const {TranslationServiceClient} = require('@google-cloud/translate'); const {Storage} = require('@google-cloud/storage'); const cp = require('child_process'); @@ -80,7 +80,7 @@ describe(REGION_TAG, () => { }); // Delete the folder from GCS for cleanup - after(async () => { + afterEach(async () => { const projectId = await translationClient.getProjectId(); const options = { prefix: `translation-${bucketUuid}`, diff --git a/translate/test/v3beta1/translate_batch_translate_document.test.js b/translate/test/v3beta1/translate_batch_translate_document.test.js index cdb81f6c46e..79e69707ae2 100644 --- a/translate/test/v3beta1/translate_batch_translate_document.test.js +++ b/translate/test/v3beta1/translate_batch_translate_document.test.js @@ -15,7 +15,7 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, before, after} = require('mocha'); +const {describe, it, before, afterEach} = require('mocha'); const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; const {Storage} = require('@google-cloud/storage'); const cp = require('child_process'); @@ -65,7 +65,7 @@ describe(REGION_TAG, () => { }); // Delete the folder from GCS for cleanup - after(async () => { + afterEach(async () => { const projectId = await translationClient.getProjectId(); const options = { prefix: `translation-${bucketUuid}`, diff --git a/translate/test/v3beta1/translate_batch_translate_text_beta.test.js b/translate/test/v3beta1/translate_batch_translate_text_beta.test.js index 9d0a52493be..c3c3ca0fba5 100644 --- a/translate/test/v3beta1/translate_batch_translate_text_beta.test.js +++ b/translate/test/v3beta1/translate_batch_translate_text_beta.test.js @@ -15,7 +15,7 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, before, after} = require('mocha'); +const {describe, it, before, afterEach} = require('mocha'); const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; const {Storage} = require('@google-cloud/storage'); const cp = require('child_process'); @@ -66,7 +66,7 @@ describe(REGION_TAG, () => { }); // Delete the folder from GCS for cleanup - after(async () => { + afterEach(async () => { const projectId = await translationClient.getProjectId(); const options = { prefix: `translation-${bucketUuid}`,