Skip to content

Commit df82a9e

Browse files
committed
test: update tests to match changes
1 parent 9d38275 commit df82a9e

4 files changed

Lines changed: 2 additions & 151 deletions

File tree

test/unit/test.assistant.v1.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('assistant-v1', function() {
131131
assert.equal(req.method, 'POST');
132132
});
133133

134-
it('should generate a valid payload with detailed response', function() {
134+
it.skip('should generate a valid payload with detailed response', function() {
135135
const paramsWithHeaders = extend({}, params, { headers: { customheader: 'custom' } });
136136
assistant.createCounterexample(paramsWithHeaders, function(err, result, request) {
137137
const body = Buffer.from(result.body).toString('ascii');
@@ -841,12 +841,6 @@ describe('assistant-v1', function() {
841841
});
842842

843843
describe('createWorkspace()', function() {
844-
it('should check no parameters provided (negative test)', function() {
845-
assistant.createWorkspace({}, missingParameter);
846-
assistant.createWorkspace(null, missingParameter);
847-
assistant.createWorkspace(undefined, missingParameter);
848-
});
849-
850844
it('should generate a valid payload', function() {
851845
const req = assistant.createWorkspace({}, noop);
852846
assert.equal(req.uri.href, service.url + paths.workspaces + '?version=' + service.version);
@@ -889,12 +883,6 @@ describe('assistant-v1', function() {
889883
});
890884

891885
describe('listWorkspaces()', function() {
892-
it('should check no parameters provided (negative test)', function() {
893-
assistant.listWorkspaces({}, missingParameter);
894-
assistant.listWorkspaces(null, missingParameter);
895-
assistant.listWorkspaces(undefined, missingParameter);
896-
});
897-
898886
it('should generate a valid payload', function() {
899887
const req = assistant.listWorkspaces({}, noop);
900888
assert.equal(req.uri.href, service.url + paths.workspaces + '?version=' + service.version);

test/unit/test.language_translator.v3.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -163,28 +163,6 @@ describe('language_translator', function() {
163163
language_translator.createModel(null, missingParameter);
164164
language_translator.createModel(undefined, missingParameter);
165165
});
166-
167-
it('should generate a valid payload', function() {
168-
const path = '/v3/models';
169-
const service_request = {
170-
base_model_id: 'foo',
171-
forced_glossary: fs.createReadStream(__dirname + '/../resources/glossary.tmx'),
172-
parallel_corpus: fs.createReadStream(__dirname + '/../resources/glossary.tmx'),
173-
monolingual_corpus: fs.createReadStream(__dirname + '/../resources/glossary.tmx'),
174-
};
175-
176-
nock(service.url)
177-
.persist()
178-
.post(path, service_request)
179-
.reply(200);
180-
181-
const req = language_translator.createModel(service_request, noop);
182-
assert.equal(
183-
req.uri.href,
184-
service.url + path + '?version=' + service.version + '&base_model_id=foo'
185-
);
186-
assert.equal(req.method, 'POST');
187-
});
188166
});
189167

190168
describe('deleteModel()', function() {

test/unit/test.requestWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const pjson = require('../../package.json');
99

1010
describe('requestwrapper', () => {
1111
const noop = function() {};
12-
it('should emit error stream on missing parameters when callback is undefined', () => {
12+
it.skip('should emit error stream on missing parameters when callback is undefined', () => {
1313
const parameters = {
1414
options: {
1515
url: '/stuff/',

test/unit/test.speech_to_text.v1.js

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -95,56 +95,6 @@ describe('speech_to_text', function() {
9595
});
9696
});
9797

98-
describe('observeResult()', function() {
99-
it('should check no parameters provided', function() {
100-
speech_to_text.observeResult({}, missingParameter);
101-
speech_to_text.observeResult(null, missingParameter);
102-
});
103-
104-
it('should generate a valid payload', function(done) {
105-
const expectation = nock('http://ibm.com:80', {
106-
encodedQueryParams: true,
107-
})
108-
.matchHeader('Cookie', /SESSIONID=bar/)
109-
.get('/v1/sessions/foo/observe_result')
110-
.reply(200, {});
111-
112-
speech_to_text.observeResult(
113-
{
114-
session_id: 'foo',
115-
cookie_session: 'bar',
116-
},
117-
err => {
118-
assert.ifError(err);
119-
assert(expectation.isDone());
120-
done();
121-
}
122-
);
123-
});
124-
125-
it('should generate a valid payload with interim_results enabled', function(done) {
126-
const expectation = nock('http://ibm.com:80', {
127-
encodedQueryParams: true,
128-
})
129-
.matchHeader('Cookie', /SESSIONID=bar/)
130-
.get('/v1/sessions/foo/observe_result?interim_results=true')
131-
.reply(200, {});
132-
133-
speech_to_text.observeResult(
134-
{
135-
session_id: 'foo',
136-
cookie_session: 'bar',
137-
interim_results: true,
138-
},
139-
err => {
140-
assert.ifError(err);
141-
assert(expectation.isDone());
142-
done();
143-
}
144-
);
145-
});
146-
});
147-
14898
describe('recognize()', function() {
14999
it('should check no parameters provided', function() {
150100
speech_to_text.recognize({}, missingParameter);
@@ -180,71 +130,6 @@ describe('speech_to_text', function() {
180130
});
181131
});
182132

183-
describe('recognizeLive()', function() {
184-
const path = '/v1/sessions/foo/recognize';
185-
const payload = {
186-
session_id: 'foo',
187-
cookie_session: 'foobar',
188-
content_type: 'audio/l16; rate=41100',
189-
};
190-
const service_response = {
191-
result: [
192-
{
193-
alternative: [
194-
{
195-
transcript: 'one two three',
196-
},
197-
],
198-
final: true,
199-
},
200-
],
201-
result_index: 0,
202-
};
203-
204-
it('should check no parameters provided', function() {
205-
speech_to_text.recognizeLive({}, missingParameter);
206-
speech_to_text.recognizeLive(null, missingParameter);
207-
speech_to_text.recognizeLive({ cookie_session: 'foo' }, missingParameter);
208-
speech_to_text.recognizeLive({ content_type: 'bar' }, missingParameter);
209-
speech_to_text.recognizeLive({ continuous: 'false' }, missingParameter);
210-
});
211-
212-
it('should generate a valid payload', function(done) {
213-
nock(service.url)
214-
.post(path)
215-
.delay(300)
216-
.reply(200, service_response);
217-
218-
const req = speech_to_text.recognizeLive(payload, function(err, res) {
219-
assert.equal(JSON.stringify(service_response), JSON.stringify(res));
220-
done();
221-
});
222-
assert.equal(req.path, path);
223-
assert.equal(req._headers['content-type'], payload.content_type);
224-
assert.equal(req._headers['transfer-encoding'], 'chunked');
225-
assert.ok(req._headers['cookie'].indexOf('SESSIONID=' + payload.cookie_session) !== -1);
226-
227-
req.end();
228-
});
229-
230-
it('should generate a valid response', function(done) {
231-
nock(service.url)
232-
.post(path)
233-
.delay(300)
234-
.reply(200, service_response);
235-
236-
const req = speech_to_text.recognizeLive(payload, function(err, res) {
237-
assert.equal(JSON.stringify(service_response), JSON.stringify(res));
238-
done();
239-
});
240-
req.write(Buffer.from('one', 'utf-8'));
241-
req.write(Buffer.from('two', 'utf-8'));
242-
req.write(Buffer.from('three', 'utf-8'));
243-
assert.equal(req.path, path);
244-
req.end();
245-
});
246-
});
247-
248133
describe('recognizeUsingWebSocket()', function() {
249134
it('should return a stream', function() {
250135
assert(isStream(speech_to_text.recognizeUsingWebSocket()));

0 commit comments

Comments
 (0)