|
| 1 | +// Copyright 2016, Google, Inc. |
| 2 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +// you may not use this file except in compliance with the License. |
| 4 | +// You may obtain a copy of the License at |
| 5 | +// |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | + |
| 14 | +'use strict'; |
| 15 | + |
| 16 | +var path = require('path'); |
| 17 | +var recognizeExample = require('../recognize_streaming'); |
| 18 | + |
| 19 | +describe('speech:recognize_streaming', function () { |
| 20 | + it('should recognize audio', function (done) { |
| 21 | + recognizeExample.main( |
| 22 | + path.join(__dirname, '../resources/audio.raw'), |
| 23 | + process.env.SPEECH_API_HOST || 'speech.googleapis.com', |
| 24 | + function (err, results) { |
| 25 | + assert(!err); |
| 26 | + assert(results); |
| 27 | + assert(results.length === 3); |
| 28 | + assert(results[0].results); |
| 29 | + assert(results[1].results); |
| 30 | + assert(results[2].results); |
| 31 | + assert(results[2].results.length === 1); |
| 32 | + assert(console.log.calledWith('Loading speech service...')); |
| 33 | + assert(console.log.calledWith('Analyzing speech...')); |
| 34 | + done(); |
| 35 | + } |
| 36 | + ); |
| 37 | + }); |
| 38 | +}); |
0 commit comments