File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const { cors, getUserAgent } = require ( "#server_functions" ) ;
1+ const { cors, getUserAgent, replaceSecretPlaceholder } = require ( "#server_functions" ) ;
22
33describe ( "server_functions tests" , ( ) => {
4+ describe ( "The replaceSecretPlaceholder method" , ( ) => {
5+ it ( "Calls string without secret placeholder" , ( ) => {
6+ const teststring = "test string without secret placeholder" ;
7+ const result = replaceSecretPlaceholder ( teststring ) ;
8+ expect ( result ) . toBe ( teststring ) ;
9+ } ) ;
10+
11+ it ( "Calls string with 2 secret placeholders" , ( ) => {
12+ const teststring = "test string with secret1=**SECRET_ONE** and secret2=**SECRET_TWO**" ;
13+ process . env . SECRET_ONE = "secret1" ;
14+ process . env . SECRET_TWO = "secret2" ;
15+ const resultstring = `test string with secret1=${ process . env . SECRET_ONE } and secret2=${ process . env . SECRET_TWO } ` ;
16+ const result = replaceSecretPlaceholder ( teststring ) ;
17+ expect ( result ) . toBe ( resultstring ) ;
18+ } ) ;
19+ } ) ;
20+
421 describe ( "The cors method" , ( ) => {
522 let fetchResponse ;
623 let fetchResponseHeadersGet ;
You can’t perform that action at this time.
0 commit comments