Skip to content

Commit

Permalink
refactor: modernize the sample tests (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Dec 18, 2018
1 parent c458bb2 commit 6e3d5ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
11 changes: 4 additions & 7 deletions packages/google-cloud-dns/samples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "nodejs-docs-samples-dns",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google Inc.",
Expand All @@ -9,18 +8,16 @@
"node": ">=8"
},
"scripts": {
"test": "mocha system-test/*.js --timeout 600000"
"test": "mocha system-test --timeout 600000"
},
"dependencies": {
"@google-cloud/dns": "^0.9.1",
"yargs": "^12.0.1"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"ava": "^0.25.0",
"nyc": "^13.0.0",
"proxyquire": "^2.0.1",
"sinon": "^7.0.0",
"chai": "^4.2.0",
"execa": "^1.0.0",
"mocha": "^5.2.0",
"uuid": "^3.3.0"
}
}
19 changes: 9 additions & 10 deletions packages/google-cloud-dns/samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
'use strict';

// [START dns_quickstart]
// Imports the Google Cloud client library
const {DNS} = require('@google-cloud/dns');

async function quickStart() {
// Your Google Cloud Platform project ID
const projectId = 'YOUR_PROJECT_ID';
async function quickstart(
projectId = 'YOUR_PROJECT_ID' // Your GCP project Id
) {
// Imports the Google Cloud client library
const {DNS} = require('@google-cloud/dns');

// Creates a client
const dns = new DNS({
projectId: projectId,
});
const dns = new DNS({projectId});

// Lists all zones in the current project
const [zones] = await dns.getZones();
console.log('Zones:');
zones.forEach(zone => console.log(zone.name));
}
quickStart().catch(console.error);
// [END dns_quickstart]

const args = process.argv.slice(2);
quickstart(...args).catch(console.error);

0 comments on commit 6e3d5ef

Please sign in to comment.