@@ -190,9 +190,6 @@ describe('Model Armor tests', () => {
190190 const SdpBasicConfigEnforcement =
191191 protos . google . cloud . modelarmor . v1 . SdpBasicConfig
192192 . SdpBasicConfigEnforcement ;
193- const SdpAdvancedConfigEnforcement =
194- protos . google . cloud . modelarmor . v1 . SdpAdvancedConfig
195- . SdpAdvancedConfigEnforcement ;
196193 const RaiFilterType = protos . google . cloud . modelarmor . v1 . RaiFilterType ;
197194
198195 // Create empty template for sanitizeUserPrompt tests
@@ -241,7 +238,6 @@ describe('Model Armor tests', () => {
241238 await createTemplate ( advanceSdpTemplateId , {
242239 sdpSettings : {
243240 advancedConfig : {
244- enforcement : SdpAdvancedConfigEnforcement . ENABLED ,
245241 inspectTemplate : dlpTemplates . inspectTemplateName ,
246242 deidentifyTemplate : dlpTemplates . deidentifyTemplateName ,
247243 } ,
@@ -496,12 +492,18 @@ describe('Model Armor tests', () => {
496492 testModelResponse
497493 ) ;
498494
499- const responseJson = JSON . stringify ( response ) ;
500-
501- assert . include ( responseJson , '"filterMatchState": "MATCH_FOUND"' ) ;
502- assert . include ( responseJson , '"sdpFilterResult"' ) ;
503- assert . include ( responseJson , '"matchState": "MATCH_FOUND"' ) ;
504- assert . include ( JSON . stringify ( response ) , expectedValue ) ;
495+ assert . equal ( response . sanitizationResult . filterMatchState , 'MATCH_FOUND' ) ;
496+ assert . exists ( response . sanitizationResult . filterResults . sdp ) ;
497+ assert . equal (
498+ response . sanitizationResult . filterResults . sdp . sdpFilterResult
499+ . deidentifyResult . matchState ,
500+ 'MATCH_FOUND'
501+ ) ;
502+ assert . equal (
503+ response . sanitizationResult . filterResults . sdp . sdpFilterResult
504+ . deidentifyResult . data . text ,
505+ expectedValue
506+ ) ;
505507 } ) ;
506508
507509 it ( 'should not detect issues in model response with empty template' , async ( ) => {
@@ -588,12 +590,13 @@ describe('Model Armor tests', () => {
588590 testUserPrompt
589591 ) ;
590592
591- const responseJson = JSON . stringify ( response ) ;
592-
593- assert . include ( responseJson , '"filterMatchState": "MATCH_FOUND"' ) ;
594- assert . include ( responseJson , '"sdpFilterResult"' ) ;
595- assert . include ( responseJson , '"matchState": "MATCH_FOUND"' ) ;
596- assert . notInclude ( responseJson , '[email protected] ' ) ; 593+ assert . equal ( response . sanitizationResult . filterMatchState , 'MATCH_FOUND' ) ;
594+ assert . exists ( response . sanitizationResult . filterResults . sdp ) ;
595+ assert . equal (
596+ response . sanitizationResult . filterResults . sdp . sdpFilterResult
597+ . deidentifyResult . matchState ,
598+ 'MATCH_FOUND'
599+ ) ;
597600 } ) ;
598601
599602 // =================== PDF File Scanning Tests ===================
0 commit comments