Skip to content

Commit

Permalink
tests: fix snippet tests in sandbox env (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored Apr 11, 2017
1 parent 12a3d10 commit a66975e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/google-cloud-vision/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,15 @@ Vision.prototype.readDocument = function(images, options, callback) {
* @private
*/
Vision.findImages_ = function(images, callback) {
if (global.GCLOUD_SANDBOX_ENV) {
callback(null, [
{
content: new Buffer('')
}
]);
return;
}

var MAX_PARALLEL_LIMIT = 5;
images = arrify(images);

Expand Down
17 changes: 17 additions & 0 deletions packages/google-cloud-vision/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,23 @@ describe('Vision', function() {
});

describe('findImages_', function() {
it('should return buffer for snippet sandbox', function(done) {
global.GCLOUD_SANDBOX_ENV = true;

Vision.findImages_({}, function(err, images) {
delete global.GCLOUD_SANDBOX_ENV;
assert.ifError(err);

assert.deepEqual(images, [
{
content: new Buffer('')
}
]);

done();
});
});

it('should convert a File object', function(done) {
var file = {
name: 'file-name',
Expand Down

0 comments on commit a66975e

Please sign in to comment.