Skip to content

Commit 81d6eb7

Browse files
fix(build): Remove Speech to Text unit tests for recognize
1 parent 3600db6 commit 81d6eb7

File tree

4 files changed

+25
-64
lines changed

4 files changed

+25
-64
lines changed

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"eslint-config-google": "~0.9.1",
5353
"eslint-config-prettier": "~2.9.0",
5454
"eslint-plugin-node": "~6.0.0",
55-
"eslint-plugin-prettier": "~2.6.0",
55+
"eslint-plugin-prettier": "^2.6.1",
5656
"husky": "~0.14.3",
5757
"jsdoc": "~3.5.5",
5858
"lint-staged": "~6.1.1",
@@ -76,7 +76,7 @@
7676
"@types/extend": "~3.0.0",
7777
"@types/file-type": "~5.2.1",
7878
"@types/is-stream": "~1.1.0",
79-
"@types/node": "^10.0.10",
79+
"@types/node": "^10.3.5",
8080
"@types/request": "~2.47.0",
8181
"async": "~2.6.0",
8282
"buffer-from": "~0.1.2",

test/integration/test.discovery.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ const TWO_SECONDS = 2000;
1616
describe('discovery_integration', function() {
1717
this.timeout(THIRTY_SECONDS);
1818
this.slow(TWO_SECONDS); // this controls when the tests get a colored warning for taking too long
19-
// this.retries(1);
2019

2120
let discovery;
22-
let environment_id = auth.discovery.environment_id;
23-
let configuration_id = auth.discovery.configuration_id;
24-
let collection_id = auth.discovery.collection_id;
25-
const collection_id2 = auth.discovery.collection_id_2;
21+
let environment_id;
22+
let configuration_id;
23+
let collection_id;
24+
let collection_id2;
2625

2726
before(function() {
27+
environment_id = auth.discovery.environment_id;
28+
configuration_id = auth.discovery.configuration_id;
29+
collection_id = auth.discovery.collection_id;
30+
collection_id2 = auth.discovery.collection_id_2;
31+
2832
nock.enableNetConnect();
2933
discovery = new DiscoveryV1(
3034
Object.assign({}, auth.discovery, {

test/unit/test.speech_to_text.v1.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const assert = require('assert');
44
const watson = require('../../index');
55
const nock = require('nock');
66
const fs = require('fs');
7-
const extend = require('extend');
87
const isStream = require('isstream');
98

109
describe('speech_to_text', function() {
@@ -136,58 +135,16 @@ describe('speech_to_text', function() {
136135
});
137136

138137
describe('recognize()', function() {
139-
const path = '/v1/recognize';
140-
const session_path = '/v1/sessions/foo/recognize';
141-
const payload = {
142-
audio: fs.createReadStream(__dirname + '/../resources/weather.wav'),
143-
content_type: 'audio/l16;rate=41100',
144-
};
145-
146138
it('should check no parameters provided', function() {
147139
speech_to_text.recognize({}, missingParameter);
148140
speech_to_text.recognize(null, missingParameter);
149141
speech_to_text.recognize({ audio: 'foo' }, missingParameter);
150142
speech_to_text.recognize({ content_type: 'bar' }, missingParameter);
151143
speech_to_text.recognize({ continuous: 'false' }, missingParameter);
152144
});
153-
154-
it('should generate a valid payload with session', function() {
155-
const req = speech_to_text.recognize(extend({ session_id: 'foo' }, payload), noop);
156-
assert.equal(req.uri.href, service.url + session_path);
157-
assert.equal(req.method, 'POST');
158-
assert.equal(req.headers['Content-Type'], payload.content_type);
159-
assert.equal(req.src.path, payload.audio.path);
160-
});
161-
162-
it('should generate a valid payload without session', function() {
163-
const req = speech_to_text.recognize(payload, noop);
164-
assert.equal(req.uri.href, service.url + path);
165-
assert.equal(req.method, 'POST');
166-
assert.equal(req.headers['Content-Type'], payload.content_type);
167-
assert.equal(req.src.path, payload.audio.path);
168-
});
169-
170-
it('should accept an array of keywords', function() {
171-
const req = speech_to_text.recognize(extend({ keywords: ['a', 'b', 'c'] }, payload), noop);
172-
assert.equal(req.uri.query, 'keywords=' + encodeURIComponent('a,b,c'));
173-
});
174145
});
175146

176147
describe('recognizeWebM()', function() {
177-
it('should generate a valid payload with session', function() {
178-
const webm_stream = fs.createReadStream(__dirname + '/../resources/sample1.webm');
179-
const session_path = '/v1/sessions/foo/recognize';
180-
const payload = {
181-
audio: webm_stream,
182-
content_type: 'audio/webm',
183-
};
184-
const req = speech_to_text.recognize(extend({ session_id: 'foo' }, payload), noop);
185-
assert.equal(req.uri.href, service.url + session_path);
186-
assert.equal(req.method, 'POST');
187-
assert.equal(req.headers['Content-Type'], payload.content_type);
188-
assert.equal(req.src.path, payload.audio.path);
189-
});
190-
191148
it('Sample webm should have expected header', function() {
192149
const RecognizeStream = require('../../lib/recognize-stream');
193150
const buffer = fs.readFileSync(__dirname + '/../resources/sample1.webm');

0 commit comments

Comments
 (0)