@@ -47,6 +47,9 @@ const RAW_RTDB_EVENT: database.RawRTDBCloudEvent = {
4747 authtype : "unauthenticated" ,
4848} ;
4949
50+ const TEST_RTDB_INSTANCE_ENV_VAR = "TEST_RTDB_INSTANCE_FOR_GETOPTS" ;
51+ const RESOLVED_RTDB_INSTANCE = "resolved-instance" ;
52+
5053describe ( "database" , ( ) => {
5154 describe ( "makeParams" , ( ) => {
5255 it ( "should make params with basic path" , ( ) => {
@@ -149,18 +152,17 @@ describe("database", () => {
149152 } ) ;
150153
151154 it ( "should resolve instance Expression to runtime string" , ( ) => {
152- const name = "TEST_RTDB_INSTANCE_FOR_GETOPTS" ;
153- const prev = process . env [ name ] ;
154- process . env [ name ] = "resolved-instance" ;
155+ const prev = process . env [ TEST_RTDB_INSTANCE_ENV_VAR ] ;
156+ process . env [ TEST_RTDB_INSTANCE_ENV_VAR ] = RESOLVED_RTDB_INSTANCE ;
155157 try {
156- const p = params . defineString ( name ) ;
158+ const p = params . defineString ( TEST_RTDB_INSTANCE_ENV_VAR ) ;
157159 expect ( database . getOpts ( { ref : "/foo" , instance : p } ) ) . to . deep . include ( {
158160 path : "foo" ,
159- instance : "resolved-instance" ,
161+ instance : RESOLVED_RTDB_INSTANCE ,
160162 } ) ;
161163 } finally {
162- if ( prev === undefined ) delete process . env [ name ] ;
163- else process . env [ name ] = prev ;
164+ if ( prev === undefined ) delete process . env [ TEST_RTDB_INSTANCE_ENV_VAR ] ;
165+ else process . env [ TEST_RTDB_INSTANCE_ENV_VAR ] = prev ;
164166 }
165167 } ) ;
166168 } ) ;
0 commit comments