Skip to content

Commit

Permalink
refactor: use explicit mocha imports (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and bcoe committed Dec 30, 2019
1 parent 3de2ae4 commit 938aeee
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 13 deletions.
1 change: 0 additions & 1 deletion vision/samples/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
rules:
no-console: off
node/no-missing-require: off
8 changes: 4 additions & 4 deletions vision/samples/setEndpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ async function setEndpoint() {
const client = new vision.ImageAnnotatorClient(clientOptions);
// [END vision_set_endpoint]

// Performs label detection on the image file
const [result] = await client.labelDetection('./resources/wakeupcat.jpg');
const labels = result.labelAnnotations;
console.log('Labels:');
// Performs text detection on the image file
const [result] = await client.textDetection('./resources/wakeupcat.jpg');
const labels = result.textAnnotations;
console.log('Text:');
labels.forEach(label => console.log(label.description));
}

Expand Down
3 changes: 0 additions & 3 deletions vision/samples/system-test/.eslintrc.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const path = require('path');
const {Storage} = require('@google-cloud/storage');
const cp = require('child_process');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const path = require('path');
const {Storage} = require('@google-cloud/storage');
const cp = require('child_process');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/batch-annotate-files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const path = require('path');
const {Storage} = require('@google-cloud/storage');
const cp = require('child_process');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/detect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const {Storage} = require('@google-cloud/storage');
const cp = require('child_process');
const uuid = require('uuid');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const vision = require('@google-cloud/vision');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/detect.v1p1beta1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const path = require('path');
const cp = require('child_process');
const {assert} = require('chai');
const {describe, it} = require('mocha');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/detect.v1p3beta1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const path = require('path');
const {Storage} = require('@google-cloud/storage');
const cp = require('child_process');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/faceDetection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

const path = require('path');
const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/importProductSets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'use strict';

const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/productSearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const uuid = require('uuid');
const vision = require('@google-cloud/vision');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/productSets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const uuid = require('uuid');
const vision = require('@google-cloud/vision');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/products.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const uuid = require('uuid');
const vision = require('@google-cloud/vision');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/quickstart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'use strict';

const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/referenceImages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const uuid = require('uuid');
const vision = require('@google-cloud/vision');
const {assert} = require('chai');
const {describe, it, before, after} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down
9 changes: 4 additions & 5 deletions vision/samples/system-test/setEndpoint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
'use strict';

const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

describe(`set endpoint for vision api call`, () => {
it(`should detect labels in a remote file from a pre-set api endpoint`, async () => {
describe('set endpoint for vision api call', () => {
it('should detect text in a remote file from a pre-set api endpoint', () => {
const stdout = execSync('node setEndpoint.js');
assert.match(stdout, /Labels:/);
assert.match(stdout, /cat/);
assert.match(stdout, /human/);
});
});
1 change: 1 addition & 0 deletions vision/samples/system-test/similarProducts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

const vision = require('@google-cloud/vision');
const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');
const path = require('path');

Expand Down
1 change: 1 addition & 0 deletions vision/samples/system-test/textDetection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

const path = require('path');
const {assert} = require('chai');
const {describe, it} = require('mocha');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
Expand Down

0 comments on commit 938aeee

Please sign in to comment.