File tree 3 files changed +89
-0
lines changed
service-directory/snippets
3 files changed +89
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nodejs-service-directory" ,
3
+ "private" : true ,
4
+ "license" : " Apache-2.0" ,
5
+ "author" : " Google LLC" ,
6
+ "engines" : {
7
+ "node" : " >=10"
8
+ },
9
+ "files" : [
10
+ " *.js"
11
+ ],
12
+ "scripts" : {
13
+ "test" : " c8 mocha --timeout 600000 test/*.js"
14
+ },
15
+ "dependencies" : {
16
+ "@google-cloud/service-directory" : " ^0.1.0"
17
+ },
18
+ "devDependencies" : {
19
+ "c8" : " ^5.0.1" ,
20
+ "chai" : " ^4.2.0" ,
21
+ "mocha" : " ^6.1.4"
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2020 Google LLC
2
+ //
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
+ // https://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
+ async function quickstart ( ) {
19
+ // [START service_directory_quickstart]
20
+ // Imports the Google Cloud client library
21
+ const { LookupServiceClient} = require ( '@google-cloud/service-directory' ) ;
22
+
23
+ // Creates a client
24
+ const ls = new LookupServiceClient ( ) ;
25
+
26
+ console . info ( ls ) ;
27
+ // [END service_directory_quickstart]
28
+ }
29
+
30
+ const args = process . argv . slice ( 2 ) ;
31
+ quickstart ( ...args ) . catch ( console . error ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2020 Google LLC
2
+ //
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
+ // https://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 path = require ( 'path' ) ;
19
+ const { assert} = require ( 'chai' ) ;
20
+ const cp = require ( 'child_process' ) ;
21
+ const { describe, it} = require ( 'mocha' ) ;
22
+
23
+ const execSync = cmd => cp . execSync ( cmd , { encoding : 'utf-8' } ) ;
24
+
25
+ const cwd = path . join ( __dirname , '..' ) ;
26
+
27
+ describe ( 'Sample Integration Tests' , ( ) => {
28
+ it ( 'should run quickstart.js' , async ( ) => {
29
+ const stdout = execSync ( 'node ./quickstart.js' , {
30
+ cwd,
31
+ } ) ;
32
+ // build should have exited with success status.
33
+ assert ( stdout ) ;
34
+ } ) ;
35
+ } ) ;
You can’t perform that action at this time.
0 commit comments