From bb2cd7377c841958e3bac3cbf98028b75e6bb69d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Wed, 13 Mar 2019 13:50:23 -0700 Subject: [PATCH] chore: update proto comments and fix tests (#316) --- speech/recognize.v1p1beta1.js | 1 + .../system-test/recognize.v1p1beta1.test.js | 31 +++---------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/speech/recognize.v1p1beta1.js b/speech/recognize.v1p1beta1.js index cfe724bc0a0..70663d94141 100644 --- a/speech/recognize.v1p1beta1.js +++ b/speech/recognize.v1p1beta1.js @@ -59,6 +59,7 @@ async function syncRecognizeWithMetaData( const config = { encoding: encoding, + sampleRateHertz: sampleRateHertz, languageCode: languageCode, metadata: recognitionMetadata, }; diff --git a/speech/system-test/recognize.v1p1beta1.test.js b/speech/system-test/recognize.v1p1beta1.test.js index 3bc8a2251c5..1e3287dbe13 100644 --- a/speech/system-test/recognize.v1p1beta1.test.js +++ b/speech/system-test/recognize.v1p1beta1.test.js @@ -16,39 +16,18 @@ 'use strict'; const path = require('path'); -const {Storage} = require('@google-cloud/storage'); const {assert} = require('chai'); -const uuid = require('uuid'); const execa = require('execa'); +const cwd = path.join(__dirname, '..'); const exec = async cmd => (await execa.shell(cmd, {cwd})).stdout; -const storage = new Storage(); -const bucketName = `nodejs-docs-samples-test-${uuid.v4()}`; const cmd = 'node recognize.v1p1beta1.js'; -const cwd = path.join(__dirname, '..'); -const filepath1 = path.join(__dirname, '..', 'resources', 'Google_Gnome.wav'); -const filepath2 = path.join( - __dirname, - '..', - 'resources', - 'commercial_mono.wav' -); +const filepath = path.join(__dirname, '..', 'resources', 'audio.raw'); +const text = 'how old is the Brooklyn Bridge'; describe('Recognize v1p1beta1', () => { - before(async () => { - const [bucket] = await storage.createBucket(bucketName); - await bucket.upload(filepath1); - }); - - after(async () => { - const bucket = storage.bucket(bucketName); - await bucket.deleteFiles({force: true}); - await bucket.deleteFiles({force: true}); // Try a second time... - await bucket.delete(); - }); - it('should run sync recognize with metadata', async () => { - const output = await exec(`${cmd} sync-metadata ${filepath2}`); - assert.match(output, /Chrome/); + const output = await exec(`${cmd} sync-metadata ${filepath}`); + assert.match(output, new RegExp(text)); }); });