Skip to content

Commit

Permalink
test: address test collisions (#502)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
  • Loading branch information
2 people authored and Ace Nassri committed Nov 17, 2022
1 parent b8c03f0 commit a93c759
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions translate/test/v3beta1/translate_create_glossary_beta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ const cp = require('child_process');
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const REGION_TAG = 'translate_create_glossary_beta';
const uuid = require('uuid');

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

it('should create a glossary', async () => {
const projectId = await translationClient.getProjectId();
const location = 'us-central1';
const glossaryId = 'test-glossary';
const output = execSync(
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
);
Expand All @@ -42,7 +43,6 @@ describe(REGION_TAG, () => {
after('cleanup for glossary create', async () => {
const projectId = await translationClient.getProjectId();
const location = 'us-central1';
const glossaryId = 'test-glossary';
// Delete the glossary to clean up
const name = translationClient.glossaryPath(
projectId,
Expand Down
5 changes: 3 additions & 2 deletions translate/test/v3beta1/translate_delete_glossary_beta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ const cp = require('child_process');
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const REGION_TAG = 'translate_delete_glossary_beta';
const uuid = require('uuid');

describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const glossaryId = 'glossary';
const glossaryId = `test_glossary_${uuid.v4()}`;

before(async () => {
// Add a glossary to be deleted
Expand Down Expand Up @@ -64,6 +65,6 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
);
assert.match(output, /glossary/);
assert.include(output, glossaryId);
});
});
5 changes: 3 additions & 2 deletions translate/test/v3beta1/translate_get_glossary_beta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ const cp = require('child_process');
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const REGION_TAG = 'translate_get_glossary_beta';
const uuid = require('uuid');

describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const glossaryId = 'test-glossary';
const glossaryId = `test-glossary-${uuid.v4()}`;

before(async () => {
// Add a glossary to get
Expand Down Expand Up @@ -63,7 +64,7 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${glossaryId}`
);
assert.match(output, /test-glossary/);
assert.include(output, glossaryId);
});

after(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ const cp = require('child_process');
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const REGION_TAG = 'translate_translate_text_with_glossary_beta';
const uuid = require('uuid');

describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const glossaryId = 'test-glossary';
const glossaryId = `test-glossary-${uuid.v4()}`;

before(async () => {
// Add a glossary to be translate with
Expand Down

0 comments on commit a93c759

Please sign in to comment.