@@ -19,7 +19,6 @@ const assert = require('assert');
1919const uuid = require ( 'uuid' ) ;
2020const { execSync} = require ( 'child_process' ) ;
2121
22- const cwd = path . join ( __dirname , '..' ) ;
2322const projectId = process . env . GCLOUD_PROJECT ;
2423const datasetId = `dataset-${ uuid . v4 ( ) } ` . replace ( / - / gi, '_' ) ;
2524const destinationDatasetId = `destination-${ uuid . v4 ( ) } ` . replace ( / - / gi, '_' ) ;
@@ -39,25 +38,22 @@ before(() => {
3938after ( ( ) => {
4039 try {
4140 execSync (
42- `node deleteDataset.js ${ projectId } ${ cloudRegion } ${ destinationDatasetId } ` ,
43- cwd
41+ `node deleteDataset.js ${ projectId } ${ cloudRegion } ${ destinationDatasetId } `
4442 ) ;
4543 // eslint-disable-next-line no-empty
4644 } catch ( err ) { } // Ignore error
4745} ) ;
4846
4947it ( 'should create a dataset' , ( ) => {
5048 const output = execSync (
51- `node createDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } ` ,
52- cwd
49+ `node createDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } `
5350 ) ;
54- assert . strictEqual ( output , ` Created dataset: ${ datasetId } ` ) ;
51+ assert . ok ( output . includes ( ' Created dataset' ) ) ;
5552} ) ;
5653
5754it ( 'should get a dataset' , ( ) => {
5855 const output = execSync (
5956 `node getDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } ` ,
60- cwd
6157 ) ;
6258 assert . ok ( output . includes ( 'name' ) ) ;
6359} ) ;
@@ -66,30 +62,24 @@ it('should patch a dataset', () => {
6662 const timeZone = 'GMT' ;
6763 const output = execSync (
6864 `node patchDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } ${ timeZone } ` ,
69- cwd
7065 ) ;
71- assert . strictEqual (
72- output ,
73- `Dataset ${ datasetId } patched with time zone ${ timeZone } `
66+ assert . ok (
67+ output . includes ( 'patched with time zone' )
7468 ) ;
7569} ) ;
7670
7771it ( 'should list datasets' , ( ) => {
78- const output = execSync (
79- `node listDatasets.js ${ projectId } ${ cloudRegion } ` ,
80- cwd
81- ) ;
72+ const output = execSync ( `node listDatasets.js ${ projectId } ${ cloudRegion } ` , {
73+ } ) ;
8274 assert . ok ( output . includes ( 'datasets' ) ) ;
8375} ) ;
8476
8577it ( 'should de-identify data in a dataset and write to a new dataset' , ( ) => {
8678 const output = execSync (
8779 `node deidentifyDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } ${ destinationDatasetId } ${ keeplistTags } ` ,
88- cwd
8980 ) ;
90- assert . strictEqual (
91- output ,
92- `De-identified data written from dataset ${ datasetId } to dataset ${ destinationDatasetId } `
81+ assert . ok (
82+ output . includes ( 'De-identified data written' )
9383 ) ;
9484} ) ;
9585
@@ -99,7 +89,6 @@ it('should create and get a dataset IAM policy', () => {
9989
10090 let output = execSync (
10191 `node setDatasetIamPolicy.js ${ projectId } ${ cloudRegion } ${ datasetId } ${ localMember } ${ localRole } ` ,
102- cwd
10392 ) ;
10493 assert . ok ( output . includes , 'ETAG' ) ;
10594
@@ -112,7 +101,6 @@ it('should create and get a dataset IAM policy', () => {
112101it ( 'should delete a dataset' , ( ) => {
113102 const output = execSync (
114103 `node deleteDataset.js ${ projectId } ${ cloudRegion } ${ datasetId } ` ,
115- cwd
116104 ) ;
117- assert . strictEqual ( output , ` Deleted dataset: ${ datasetId } ` ) ;
105+ assert . ok ( output . includes ( ' Deleted dataset' ) ) ;
118106} ) ;
0 commit comments