Skip to content

Commit

Permalink
test: add a basic system test (#106)
Browse files Browse the repository at this point in the history
* test: add a basic system test

* fixy
  • Loading branch information
JustinBeckwith authored and jkwlui committed Dec 20, 2018
1 parent 854b88f commit 870b4bc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
5 changes: 0 additions & 5 deletions packages/google-cloud-automl/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
.coverage
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
10 changes: 3 additions & 7 deletions packages/google-cloud-automl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"main": "src/index.js",
"files": [
"protos",
"src",
"AUTHORS",
"COPYING"
"src"
],
"keywords": [
"google apis client",
Expand All @@ -29,11 +27,9 @@
"Cloud AutoML API"
],
"scripts": {
"test": "npm run cover",
"cover": "nyc --reporter=lcov mocha test/*.js && nyc report",
"test": "nyc mocha",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"test-no-cover": "mocha test/*.js --timeout 600000",
"lint": "eslint src/ samples/ system-test/ test/",
"lint": "eslint '**/*.js'",
"docs": "jsdoc -c .jsdoc.js",
"system-test": "mocha system-test/*.js --timeout 600000",
"fix": "eslint '**/*.js' --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-automl/system-test/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
env:
mocha: true
rules:
node/no-unpublished-require: off
node/no-unsupported-features/es-syntax: off
no-console: off
15 changes: 14 additions & 1 deletion packages/google-cloud-automl/system-test/automl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

console.warn('No system tests available 😧');
const automl = require('../src');
const assert = require('assert');

const client = new automl.AutoMlClient();
const location = 'us-central1';
const projectId = process.env.GCLOUD_PROJECT;

describe('automl system tests', () => {
it('should list all datasets', async () => {
const parent = client.locationPath(projectId, location);
const [datasets] = await client.listDatasets({parent});
assert.ok(Array.isArray(datasets));
});
});
2 changes: 0 additions & 2 deletions packages/google-cloud-automl/test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---
env:
mocha: true
rules:
node/no-unpublished-require: off

0 comments on commit 870b4bc

Please sign in to comment.