Skip to content

Commit

Permalink
Cleanup App Engine samples and re-work tests. (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry authored and Ace Nassri committed Nov 17, 2022
1 parent 459044f commit bd5acb9
Show file tree
Hide file tree
Showing 4 changed files with 3,025 additions and 97 deletions.
2 changes: 1 addition & 1 deletion video-intelligence/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function analyzeShots (gcsUri) {
// [END analyze_shots]
}

const cli = require(`yargs`)
require(`yargs`) // eslint-disable-line
.demand(1)
.command(
`faces <gcsUri>`,
Expand Down
25 changes: 20 additions & 5 deletions video-intelligence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@
"name": "nodejs-docs-samples-videointelligence",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"repository": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"cloud": {
"requiresKeyFile": true,
"requiresProjectId": true
},
"engines": {
"node": ">=4.3.2"
},
"scripts": {
"test": "cd ..; npm run st -- --verbose video/system-test/*.test.js"
"lint": "samples lint",
"pretest": "npm run lint",
"system-test": "ava -T 10m --verbose system-test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/videointelligence": "https://storage.googleapis.com/videointelligence-alpha/videointelligence-nodejs.tar.gz",
"yargs": "7.0.2"
"yargs": "7.1.0"
},
"engines": {
"node": ">=4.3.2"
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.3.1",
"ava": "0.19.1"
}
}
9 changes: 5 additions & 4 deletions video-intelligence/system-test/analyze.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@

'use strict';

require(`../../system-test/_setup`);
const path = require(`path`);
const test = require(`ava`);
const tools = require(`@google-cloud/nodejs-repo-tools`);

const cmd = `node analyze.js`;
const cwd = path.join(__dirname, `..`);

// analyze_faces
test(`should analyze faces`, async (t) => {
const output = await runAsync(`${cmd} faces gs://nodejs-docs-samples/video/google_gmail.mp4`, cwd);
const output = await tools.runAsync(`${cmd} faces gs://nodejs-docs-samples/video/google_gmail.mp4`, cwd);
t.regex(output, /Thumbnail size: \d+/);
});

// analyze_labels
test(`should analyze labels`, async (t) => {
const output = await runAsync(`${cmd} labels gs://nodejs-docs-samples/video/cat.mp4`, cwd);
const output = await tools.runAsync(`${cmd} labels gs://nodejs-docs-samples/video/cat.mp4`, cwd);
t.regex(output, /Label description: Whiskers/);
});

// analyze_shots
test(`should analyze shots`, async (t) => {
const output = await runAsync(`${cmd} shots gs://nodejs-docs-samples/video/gbike_dinosaur.mp4`, cwd);
const output = await tools.runAsync(`${cmd} shots gs://nodejs-docs-samples/video/gbike_dinosaur.mp4`, cwd);
t.regex(output, /Scene 0:/);
});
Loading

0 comments on commit bd5acb9

Please sign in to comment.