Skip to content

Commit a93c759

Browse files
bcoeJustinBeckwith
authored and
Ace Nassri
committed
test: address test collisions (#502)
Co-authored-by: Justin Beckwith <[email protected]>
1 parent b8c03f0 commit a93c759

4 files changed

+10
-7
lines changed

translate/test/v3beta1/translate_create_glossary_beta.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ const cp = require('child_process');
2222
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2323

2424
const REGION_TAG = 'translate_create_glossary_beta';
25+
const uuid = require('uuid');
2526

2627
describe(REGION_TAG, () => {
2728
const translationClient = new TranslationServiceClient();
29+
const glossaryId = `test-glossary-${uuid.v4()}`;
2830

2931
it('should create a glossary', async () => {
3032
const projectId = await translationClient.getProjectId();
3133
const location = 'us-central1';
32-
const glossaryId = 'test-glossary';
3334
const output = execSync(
3435
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
3536
);
@@ -42,7 +43,6 @@ describe(REGION_TAG, () => {
4243
after('cleanup for glossary create', async () => {
4344
const projectId = await translationClient.getProjectId();
4445
const location = 'us-central1';
45-
const glossaryId = 'test-glossary';
4646
// Delete the glossary to clean up
4747
const name = translationClient.glossaryPath(
4848
projectId,

translate/test/v3beta1/translate_delete_glossary_beta.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ const cp = require('child_process');
2222
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2323

2424
const REGION_TAG = 'translate_delete_glossary_beta';
25+
const uuid = require('uuid');
2526

2627
describe(REGION_TAG, () => {
2728
const translationClient = new TranslationServiceClient();
2829
const location = 'us-central1';
29-
const glossaryId = 'glossary';
30+
const glossaryId = `test_glossary_${uuid.v4()}`;
3031

3132
before(async () => {
3233
// Add a glossary to be deleted
@@ -64,6 +65,6 @@ describe(REGION_TAG, () => {
6465
const output = execSync(
6566
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
6667
);
67-
assert.match(output, /glossary/);
68+
assert.include(output, glossaryId);
6869
});
6970
});

translate/test/v3beta1/translate_get_glossary_beta.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ const cp = require('child_process');
2222
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2323

2424
const REGION_TAG = 'translate_get_glossary_beta';
25+
const uuid = require('uuid');
2526

2627
describe(REGION_TAG, () => {
2728
const translationClient = new TranslationServiceClient();
2829
const location = 'us-central1';
29-
const glossaryId = 'test-glossary';
30+
const glossaryId = `test-glossary-${uuid.v4()}`;
3031

3132
before(async () => {
3233
// Add a glossary to get
@@ -63,7 +64,7 @@ describe(REGION_TAG, () => {
6364
const output = execSync(
6465
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
6566
);
66-
assert.match(output, /test-glossary/);
67+
assert.include(output, glossaryId);
6768
});
6869

6970
after(async () => {

translate/test/v3beta1/translate_translate_text_with_glossary_beta.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ const cp = require('child_process');
2222
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2323

2424
const REGION_TAG = 'translate_translate_text_with_glossary_beta';
25+
const uuid = require('uuid');
2526

2627
describe(REGION_TAG, () => {
2728
const translationClient = new TranslationServiceClient();
2829
const location = 'us-central1';
29-
const glossaryId = 'test-glossary';
30+
const glossaryId = `test-glossary-${uuid.v4()}`;
3031

3132
before(async () => {
3233
// Add a glossary to be translate with

0 commit comments

Comments
 (0)