Skip to content

Commit

Permalink
feat!: initial generation of library (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored and Aaron Gabriel Neyer committed Nov 17, 2022
1 parent 00af12d commit 8121e4c
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
23 changes: 23 additions & 0 deletions service-directory/snippets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "nodejs-service-directory",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=10"
},
"files": [
"*.js"
],
"scripts": {
"test": "c8 mocha --timeout 600000 test/*.js"
},
"dependencies": {
"@google-cloud/service-directory": "^0.1.0"
},
"devDependencies": {
"c8": "^5.0.1",
"chai": "^4.2.0",
"mocha": "^6.1.4"
}
}
31 changes: 31 additions & 0 deletions service-directory/snippets/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function quickstart() {
// [START service_directory_quickstart]
// Imports the Google Cloud client library
const {LookupServiceClient} = require('@google-cloud/service-directory');

// Creates a client
const ls = new LookupServiceClient();

console.info(ls);
// [END service_directory_quickstart]
}

const args = process.argv.slice(2);
quickstart(...args).catch(console.error);
35 changes: 35 additions & 0 deletions service-directory/snippets/test/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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 path = require('path');
const {assert} = require('chai');
const cp = require('child_process');
const {describe, it} = require('mocha');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const cwd = path.join(__dirname, '..');

describe('Sample Integration Tests', () => {
it('should run quickstart.js', async () => {
const stdout = execSync('node ./quickstart.js', {
cwd,
});
// build should have exited with success status.
assert(stdout);
});
});

0 comments on commit 8121e4c

Please sign in to comment.