Skip to content

Commit

Permalink
test: add sample tests (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and ahrarmonsur committed Nov 17, 2022
1 parent 9f0bd69 commit 4608fab
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
9 changes: 7 additions & 2 deletions container/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
},
"repository": "googleapis/nodejs-cloud-container",
"private": true,
"files": [
"*.js"
],
"scripts": {
"test": "echo no sample tests 👻"
"test": "mocha system-test --timeout 10000"
},
"dependencies": {
"@google-cloud/container": "^0.3.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0"
"chai": "^4.2.0",
"execa": "^1.0.0",
"mocha": "^5.2.0"
}
}
1 change: 1 addition & 0 deletions container/snippets/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function main() {
};

const [response] = await client.listClusters(request);
console.log('Clusters:');
console.log(response);
// [END container_quickstart]
}
Expand Down
6 changes: 2 additions & 4 deletions container/snippets/system-test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---
rules:
node/no-unpublished-require: off
node/no-unsupported-features: off
no-empty: off
env:
mocha: true
26 changes: 26 additions & 0 deletions container/snippets/system-test/sample.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2017, Google, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

const {assert} = require('chai');
const execa = require('execa');

describe('container samples', () => {
it('should run the quickstart', async () => {
const {stdout} = await execa.shell('node quickstart');
assert.match(stdout, /Clusters:/);
});
});

0 comments on commit 4608fab

Please sign in to comment.