@@ -62,6 +62,38 @@ describe("AppSec orchestrator", () => {
6262 expect ( mockPublish ) . toHaveBeenCalled ( ) ;
6363 } ) ;
6464
65+ it ( "should enable when DD_APPSEC_ENABLED is TRUE (uppercase)" , ( ) => {
66+ process . env . DD_APPSEC_ENABLED = "TRUE" ;
67+ initAppsec ( ) ;
68+
69+ const span = { setTag : jest . fn ( ) } ;
70+ mockExtract . mockReturnValue ( {
71+ headers : { } ,
72+ method : "GET" ,
73+ path : "/" ,
74+ isBase64Encoded : false ,
75+ } ) ;
76+
77+ processAppsecRequest ( { } , span ) ;
78+ expect ( mockPublish ) . toHaveBeenCalled ( ) ;
79+ } ) ;
80+
81+ it ( "should enable when DD_APPSEC_ENABLED is True (mixed case)" , ( ) => {
82+ process . env . DD_APPSEC_ENABLED = "True" ;
83+ initAppsec ( ) ;
84+
85+ const span = { setTag : jest . fn ( ) } ;
86+ mockExtract . mockReturnValue ( {
87+ headers : { } ,
88+ method : "GET" ,
89+ path : "/" ,
90+ isBase64Encoded : false ,
91+ } ) ;
92+
93+ processAppsecRequest ( { } , span ) ;
94+ expect ( mockPublish ) . toHaveBeenCalled ( ) ;
95+ } ) ;
96+
6597 it ( "should not enable when DD_APPSEC_ENABLED is not set" , ( ) => {
6698 delete process . env . DD_APPSEC_ENABLED ;
6799 initAppsec ( ) ;
@@ -77,6 +109,14 @@ describe("AppSec orchestrator", () => {
77109 processAppsecRequest ( { } , { } ) ;
78110 expect ( mockPublish ) . not . toHaveBeenCalled ( ) ;
79111 } ) ;
112+
113+ it ( "should not enable when DD_APPSEC_ENABLED is FALSE (uppercase)" , ( ) => {
114+ process . env . DD_APPSEC_ENABLED = "FALSE" ;
115+ initAppsec ( ) ;
116+
117+ processAppsecRequest ( { } , { } ) ;
118+ expect ( mockPublish ) . not . toHaveBeenCalled ( ) ;
119+ } ) ;
80120 } ) ;
81121
82122 describe ( "processAppSecRequest" , ( ) => {
0 commit comments