@@ -2,7 +2,8 @@ import { Assert, AITestClass, PollingAssert } from "@microsoft/ai-test-framework
22import {
33 IConfiguration , ITelemetryPlugin , ITelemetryItem , IPlugin , IAppInsightsCore , normalizeJsName ,
44 random32 , mwcRandomSeed , newId , randomValue , mwcRandom32 , isNullOrUndefined , SenderPostManager ,
5- OnCompleteCallback , IPayloadData , _ISenderOnComplete , TransportType , _ISendPostMgrConfig , fieldRedaction
5+ OnCompleteCallback , IPayloadData , _ISenderOnComplete , TransportType , _ISendPostMgrConfig , fieldRedaction ,
6+ isString
67} from "../../../src/applicationinsights-core-js"
78import { AppInsightsCore } from "../../../src/JavaScriptSDK/AppInsightsCore" ;
89import { IChannelControls } from "../../../src/JavaScriptSDK.Interfaces/IChannelControls" ;
@@ -2106,6 +2107,38 @@ export class ApplicationInsightsCoreTests extends AITestClass {
21062107 }
21072108 } ) ;
21082109
2110+ this . testCase ( {
2111+ name : "FieldRedaction: should return non-string values unchanged without processing" ,
2112+ test : ( ) => {
2113+
2114+ let config = { } as IConfiguration ;
2115+ // Test with null - should return null unchanged
2116+ const nullUrl = null ;
2117+ const redactedLocation = fieldRedaction ( nullUrl as any , config ) ;
2118+ Assert . strictEqual ( redactedLocation , null , "fieldRedaction should return null unchanged" ) ;
2119+
2120+ // Test with number - should return the number unchanged
2121+ const numberUrl = 12345 ;
2122+ const redactedNumber = fieldRedaction ( numberUrl as any , config ) ;
2123+ Assert . strictEqual ( redactedNumber , 12345 , "fieldRedaction should return number unchanged" ) ;
2124+
2125+ // Test with object - should return the object unchanged
2126+ const objectUrl = { url : "https://example.com" } ;
2127+ const redactedObject = fieldRedaction ( objectUrl as any , config ) ;
2128+ Assert . strictEqual ( redactedObject , objectUrl , "fieldRedaction should return object unchanged" ) ;
2129+
2130+ // Test with array - should return the array unchanged
2131+ const arrayUrl = [ "https://example.com" ] ;
2132+ const redactedArray = fieldRedaction ( arrayUrl as any , config ) ;
2133+ Assert . strictEqual ( redactedArray , arrayUrl , "fieldRedaction should return array unchanged" ) ;
2134+
2135+ // Test with boolean - should return the boolean unchanged
2136+ const boolUrl = true ;
2137+ const redactedBool = fieldRedaction ( boolUrl as any , config ) ;
2138+ Assert . strictEqual ( redactedBool , true , "fieldRedaction should return boolean unchanged" ) ;
2139+ }
2140+ } ) ;
2141+
21092142 this . testCase ( {
21102143 name : "FieldRedaction: should handle URLs with Unicode characters" ,
21112144 test : ( ) => {
0 commit comments