Skip to content

Commit a828aed

Browse files
JustinBeckwithAce Nassri
authored and
Ace Nassri
committed
test: add sample tests (#143)
1 parent 34b0845 commit a828aed

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

container/snippets/package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
},
88
"repository": "googleapis/nodejs-cloud-container",
99
"private": true,
10+
"files": [
11+
"*.js"
12+
],
1013
"scripts": {
11-
"test": "echo no sample tests 👻"
14+
"test": "mocha system-test --timeout 10000"
1215
},
1316
"dependencies": {
1417
"@google-cloud/container": "^0.3.0"
1518
},
1619
"devDependencies": {
17-
"@google-cloud/nodejs-repo-tools": "^3.0.0"
20+
"chai": "^4.2.0",
21+
"execa": "^1.0.0",
22+
"mocha": "^5.2.0"
1823
}
1924
}

container/snippets/quickstart.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async function main() {
3939
};
4040

4141
const [response] = await client.listClusters(request);
42+
console.log('Clusters:');
4243
console.log(response);
4344
// [END container_quickstart]
4445
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
---
2-
rules:
3-
node/no-unpublished-require: off
4-
node/no-unsupported-features: off
5-
no-empty: off
2+
env:
3+
mocha: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright 2017, Google, Inc.
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
'use strict';
17+
18+
const {assert} = require('chai');
19+
const execa = require('execa');
20+
21+
describe('container samples', () => {
22+
it('should run the quickstart', async () => {
23+
const {stdout} = await execa.shell('node quickstart');
24+
assert.match(stdout, /Clusters:/);
25+
});
26+
});

0 commit comments

Comments
 (0)