File tree Expand file tree Collapse file tree
packages/google-monitoring-dashboard/samples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 "chai" : " ^4.2.0" ,
2121 "mocha" : " ^8.0.0"
2222 }
23- }
23+ }
Original file line number Diff line number Diff line change 1818const path = require ( 'path' ) ;
1919const { assert} = require ( 'chai' ) ;
2020const cp = require ( 'child_process' ) ;
21- const { describe, it} = require ( 'mocha' ) ;
21+ const { describe, it, before} = require ( 'mocha' ) ;
22+ const {
23+ DashboardsServiceClient,
24+ } = require ( '@google-cloud/monitoring-dashboards' ) ;
2225
26+ // Creates a client
27+ const ds = new DashboardsServiceClient ( ) ;
2328const execSync = cmd => cp . execSync ( cmd , { encoding : 'utf-8' } ) ;
2429
2530const cwd = path . join ( __dirname , '..' ) ;
2631
27- const PROJECT_ID = process . env . GCLOUD_PROJECT ;
28-
2932describe ( 'Sample Integration Tests' , ( ) => {
33+ let projectId ;
34+ before ( async ( ) => {
35+ projectId = await ds . getProjectId ( ) ;
36+ } ) ;
3037 it ( 'should run quickstart.js' , async ( ) => {
31- const stdout = execSync ( `node ./quickstart.js projects/${ PROJECT_ID } ` , {
38+ const stdout = execSync ( `node ./quickstart.js projects/${ projectId } ` , {
3239 cwd,
3340 } ) ;
3441 // build should have exited with success status.
You can’t perform that action at this time.
0 commit comments