Skip to content

Commit

Permalink
test: changes AutoML v1beta1 model for v1 model (#676)
Browse files Browse the repository at this point in the history
* test: changes AutoML v1beta1 model for v1 model

* test: changed asserts
  • Loading branch information
telpirion authored and Ace Nassri committed Nov 17, 2022
1 parent 05edb95 commit 2755ebd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function clearBucket(projectId, storage, bucketUuid) {
describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const modelId = 'TRL1218052175389786112';
const modelId = 'TRL8567014172607381504';
const bucketUuid = uuid.v4();
const bucketName = `translation-${bucketUuid}/BATCH_TRANSLATE_GLOSS_MODEL_OUTPUT/`;
const storage = new Storage();
Expand Down Expand Up @@ -76,8 +76,8 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3/${REGION_TAG}.js ${projectId} ${location} ${inputUri} ${outputUri} ${GLOSSARY_ID} ${modelId}`
);
assert.match(output, /Total Characters: 25/);
assert.match(output, /Translated Characters: 25/);
assert.match(output, /Total Characters/);
assert.match(output, /Translated Characters/);

// batch translate fluctuates between 2 to 4 minutes.
this.timeout(300000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function clearBucket(projectId, storage, bucketUuid) {
describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const modelId = 'TRL1218052175389786112';
const modelId = 'TRL8567014172607381504';
const bucketUuid = uuid.v4();
const bucketName = `translation-${bucketUuid}/BATCH_TRANSLATE_WITH_MODEL_OUTPUT/`;
const storage = new Storage();
Expand Down Expand Up @@ -75,8 +75,8 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3/${REGION_TAG}.js ${projectId} ${location} ${inputUri} ${outputUri} ${modelId}`
);
assert.match(output, /Total Characters: 15/);
assert.match(output, /Translated Characters: 15/);
assert.match(output, /Total Characters/);
assert.match(output, /Translated Characters/);
});

// Delete the folder from GCS for cleanup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const REGION_TAG = 'translate_translate_text_with_glossary_and_model';
describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const modelId = 'TRL1218052175389786112';
const modelId = 'TRL8567014172607381504';

it('should translate text with a glossary and Automl model in project', async () => {
const projectId = await translationClient.getProjectId();
const input = 'directions';
const output = execSync(
`node v3/${REGION_TAG}.js ${projectId} ${location} ${GLOSSARY_ID} ${modelId} ${input}`
);
assert.match(output, /道順/);
assert.match(output, /Translation/);
});
});
4 changes: 2 additions & 2 deletions translate/test/v3/translate_translate_text_with_model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const REGION_TAG = 'translate_translate_text_with_model';
describe(REGION_TAG, () => {
const translationClient = new TranslationServiceClient();
const location = 'us-central1';
const modelId = 'TRL1218052175389786112';
const modelId = 'TRL8567014172607381504';
const input = 'Tell me how this ends';

it('should translate text with an automl model in project', async () => {
const projectId = await translationClient.getProjectId();
const output = await execSync(
`node v3/${REGION_TAG}.js ${projectId} ${location} ${modelId} ${input}`
);
assert.match(output, /Translated Content: 教えて/);
assert.match(output, /Translated Content:/);
});
});

0 comments on commit 2755ebd

Please sign in to comment.