Skip to content

Commit

Permalink
Merge pull request #1194 from stephenplusplus/spp--vision-bug-fix
Browse files Browse the repository at this point in the history
vision: fixes for API changes
  • Loading branch information
callmehiphop committed Apr 1, 2016
2 parents 1877e0c + 93ebadd commit 367f9d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
20 changes: 10 additions & 10 deletions lib/vision/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,16 +963,16 @@ Vision.prototype.detectLogos = function(images, options, callback) {
* vision.detectProperties('image.jpg', function(err, props, apiResponse) {
* // props = {
* // colors: [
* // '#3b3027',
* // '#727d81',
* // '#3f2f22',
* // '#838e92',
* // '#482a16',
* // '#5f4f3c',
* // '#261b14',
* // '#b39b7f',
* // '#51473f',
* // '#2c1e12'
* // '3b3027',
* // '727d81',
* // '3f2f22',
* // '838e92',
* // '482a16',
* // '5f4f3c',
* // '261b14',
* // 'b39b7f',
* // '51473f',
* // '2c1e12'
* // ]
* // }
* });
Expand Down
26 changes: 16 additions & 10 deletions system-test/vision.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Vision', function() {
vision.detectLabels(IMAGES.rushmore, function(err, labels) {
assert.ifError(err);

assert(labels.indexOf('classical sculpture') > -1);
assert(labels.length > -1);

done();
});
Expand All @@ -97,8 +97,8 @@ describe('Vision', function() {

assert.strictEqual(labels.length, 2);

assert(labels[0].indexOf('logo') > -1);
assert(labels[1].indexOf('classical sculpture') > -1);
assert(labels[0].length > -1);
assert(labels[1].length > -1);

done();
});
Expand Down Expand Up @@ -310,18 +310,24 @@ describe('Vision', function() {
});

describe('text', function() {
var expectedText = multiline.stripIndent(function() {/*
Google Cloud Client Library for Node.js an idiomatic, intuitive, and
natural way for Node.js developers to integrate with Google Cloud
Platform services, like Cloud Datastore and Cloud Storage.
var expectedResults = [
multiline.stripIndent(function() {/*
Google Cloud Client Library for Node.js an idiomatic, intuitive, and
natural way for Node.js developers to integrate with Google Cloud
Platform services, like Cloud Datastore and Cloud Storage.
*/});
*/})
];

expectedResults = expectedResults.concat(
expectedResults[0].replace(/\n/g, ' ').trim().split(' ')
);

it('should detect text', function(done) {
vision.detectText(IMAGES.text, function(err, text) {
assert.ifError(err);

assert.deepEqual(text, [expectedText]);
assert.deepEqual(text, expectedResults);

done();
});
Expand All @@ -336,7 +342,7 @@ describe('Vision', function() {

assert.strictEqual(texts.length, 2);
assert.deepEqual(texts[0], []);
assert.deepEqual(texts[1], [expectedText]);
assert.deepEqual(texts[1], expectedResults);

done();
});
Expand Down

0 comments on commit 367f9d4

Please sign in to comment.