Skip to content

Commit

Permalink
refactor(visual-recognition): remove compatibility layer for visual r…
Browse files Browse the repository at this point in the history
…ecognition

BREAKING CHANGE: Deprecated methods in Visual Recognition are no longer available. Changed parameter names are no longer interally corrected.

To migrate your code, use the methods and parameters currently available with the service as documented here: https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/node.html?node
  • Loading branch information
dpopp07 committed Oct 15, 2018
1 parent 9f10898 commit 6377067
Show file tree
Hide file tree
Showing 4 changed files with 884 additions and 1,077 deletions.
57 changes: 0 additions & 57 deletions test/integration/test.adapter.tone_analyzer.js

This file was deleted.

46 changes: 3 additions & 43 deletions test/unit/test.visual_recognition.v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('visual_recognition', function() {
});

it('should generate a valid payload with streams', function() {
const params = { image_file: fake_file };
const params = { images_file: fake_file };
const req = visual_recognition.classify(params, noop);
assert.equal(req.uri.href, service.url + classify_path);
assert.equal(req.method, 'POST');
Expand All @@ -193,7 +193,7 @@ describe('visual_recognition', function() {
it('should generate a valid paylod with buffers', function() {
const params = {
images_file: fake_buffer,
parameters: { owners: ['me', 'IBM'] },
owners: ['me', 'IBM'],
};
const req = visual_recognition.classify(params, noop);
assert.equal(req.uri.href, service.url + classify_path);
Expand Down Expand Up @@ -244,7 +244,7 @@ describe('visual_recognition', function() {
});

it('should generate a valid payload with streams', function() {
const params = { image_file: fake_file };
const params = { images_file: fake_file };
const req = visual_recognition.detectFaces(params, noop);
assert.equal(req.uri.href, service.url + detect_faces_path);
assert.equal(req.method, 'POST');
Expand Down Expand Up @@ -343,11 +343,6 @@ describe('visual_recognition', function() {
done();
});
});
describe('retrainClassifier()', function() {
it('should call updateClassifier()', function() {
visual_recognition.retrainClassifier({}, missingParameter);
});
});

describe('updateClassifier()', function() {
it('should check no/insufficient parameters provided', function() {
Expand Down Expand Up @@ -529,39 +524,4 @@ describe('visual_recognition', function() {
assert.equal(req.method, 'GET');
});
});

describe('Print a warning for deprecated methods()', function() {
let spy;
beforeEach(function() {
spy = sinon.stub(console, 'warn');
});
afterEach(function() {
spy.restore();
});
after(function() {
spy.restore();
});

const deprecatedMethods = [
'recognizeText',
'createCollection',
'getCollection',
'listCollections',
'deleteCollection',
'addImage',
'listImages',
'getImage',
'deleteImage',
'setImageData',
'getImageData',
'deleteImageData',
'findSimilar',
];
deprecatedMethods.forEach(function(method) {
it(`${method} should print a warning message`, function() {
visual_recognition[method]({}, noop);
assert(spy.calledOnce);
});
});
});
});
Loading

0 comments on commit 6377067

Please sign in to comment.