@@ -8,7 +8,11 @@ const undici = require("undici");
88const { cors, getUserAgent, replaceSecretPlaceholder } = require ( "#server_functions" ) ;
99
1010describe ( "server_functions tests" , ( ) => {
11- describe ( "The replaceSecretPlaceholder method" , ( ) => {
11+ describe ( "The replaceSecretPlaceholder method with cors=allowWhitelist" , ( ) => {
12+ beforeEach ( ( ) => {
13+ global . config = { cors : "allowWhitelist" } ;
14+ } ) ;
15+
1216 it ( "Calls string without secret placeholder" , ( ) => {
1317 const teststring = "test string without secret placeholder" ;
1418 const result = replaceSecretPlaceholder ( teststring ) ;
@@ -25,6 +29,24 @@ describe("server_functions tests", () => {
2529 } ) ;
2630 } ) ;
2731
32+ describe ( "The replaceSecretPlaceholder method with cors=allowAll" , ( ) => {
33+ beforeEach ( ( ) => {
34+ global . config = { cors : "allowAll" } ;
35+ } ) ;
36+
37+ it ( "Calls string without secret placeholder" , ( ) => {
38+ const teststring = "test string without secret placeholder" ;
39+ const result = replaceSecretPlaceholder ( teststring ) ;
40+ expect ( result ) . toBe ( teststring ) ;
41+ } ) ;
42+
43+ it ( "Calls string with 2 secret placeholders" , ( ) => {
44+ const teststring = "test string with secret1=**SECRET_ONE** and secret2=**SECRET_TWO**" ;
45+ const result = replaceSecretPlaceholder ( teststring ) ;
46+ expect ( result ) . toBe ( teststring ) ;
47+ } ) ;
48+ } ) ;
49+
2850 describe ( "The cors method" , ( ) => {
2951 let fetchSpy ;
3052 let fetchResponseHeadersGet ;
0 commit comments