@@ -20,32 +20,24 @@ const {AutoMlClient} = require('@google-cloud/automl').v1;
2020
2121const cp = require ( 'child_process' ) ;
2222
23- const execSync = cmd => cp . execSync ( cmd , { encoding : 'utf-8' } ) ;
24-
25- const CREATE_MODEL_REGION_TAG = 'language_entity_extraction_create_model' ;
23+ const CREATE_MODEL_REGION_TAG = 'language_entity_extraction_create_model.js' ;
2624const LOCATION = 'us-central1' ;
27- const DATASET_ID = 'TEN8374527069979148288 ' ;
25+ const DATASET_ID = 'TEN0000000000000000000 ' ;
2826
2927describe ( 'Automl Natural Language Entity Extraction Create Model Test' , ( ) => {
3028 const client = new AutoMlClient ( ) ;
3129 // let operationId;
3230
3331 // Natural language entity extraction models are non cancellable operations
34- it . skip ( 'should create a model' , async ( ) => {
32+ it ( 'should create a model' , async ( ) => {
33+ // As entity extraction does not let you cancel model creation, instead try
34+ // to create a model from a nonexistent dataset, but other elements of the
35+ // request were valid.
3536 const projectId = await client . getProjectId ( ) ;
37+ const args = [ CREATE_MODEL_REGION_TAG , projectId , LOCATION , DATASET_ID ] ;
38+ const output = cp . spawnSync ( 'node' , args , { encoding : 'utf8' } ) ;
3639
37- const create_output = execSync (
38- `node ${ CREATE_MODEL_REGION_TAG } .js ${ projectId } ${ LOCATION } ${ DATASET_ID } extraction_test_create_model`
39- ) ;
40-
41- assert . match ( create_output , / T r a i n i n g s t a r t e d / ) ;
42-
43- // operationId = create_output
44- // .split('Training operation name: ')[1]
45- // .split('\n')[0];
40+ assert . match ( output . stderr , / N O T _ F O U N D / ) ;
41+ assert . match ( output . stderr , / D a t a s e t d o e s n o t e x i s t ./ ) ;
4642 } ) ;
47-
48- // after('cancel model training', async () => {
49- // await client.operationsClient.cancelOperation({name: operationId});
50- // });
5143} ) ;
0 commit comments