@@ -47,6 +47,7 @@ import { EventAccumulatorFactory } from '../helpers/EventAccumulator';
47
47
import {
48
48
DATABASE_ADDRESS ,
49
49
DATABASE_URL ,
50
+ EMULATOR_PORT ,
50
51
getFreshRepo ,
51
52
getRWRefs ,
52
53
isEmulatorActive ,
@@ -143,33 +144,36 @@ describe('Database@exp Tests', () => {
143
144
it ( 'can connected to emulator' , async ( ) => {
144
145
if ( isEmulatorActive ( ) ) {
145
146
const db = getDatabase ( defaultApp ) ;
146
- connectDatabaseEmulator ( db , 'localhost' , 9000 ) ;
147
+ connectDatabaseEmulator ( db , 'localhost' , parseInt ( EMULATOR_PORT , 10 ) ) ;
147
148
await get ( refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) ) ;
148
149
}
149
150
} ) ;
150
151
151
152
it ( 'can chnage emulator config before network operations' , async ( ) => {
152
153
if ( isEmulatorActive ( ) ) {
153
154
const db = getDatabase ( defaultApp ) ;
154
- connectDatabaseEmulator ( db , 'localhost' , 9001 ) ;
155
- connectDatabaseEmulator ( db , 'localhost' , 9000 ) ;
155
+ const port = parseInt ( EMULATOR_PORT , 10 ) ;
156
+ connectDatabaseEmulator ( db , 'localhost' , port + 1 ) ;
157
+ connectDatabaseEmulator ( db , 'localhost' , port ) ;
156
158
await get ( refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) ) ;
157
159
}
158
160
} ) ;
159
161
160
162
it ( 'can connected to emulator after network operations with same parameters' , async ( ) => {
161
163
if ( isEmulatorActive ( ) ) {
162
164
const db = getDatabase ( defaultApp ) ;
163
- connectDatabaseEmulator ( db , 'localhost' , 9000 ) ;
165
+ const port = parseInt ( EMULATOR_PORT , 10 ) ;
166
+ connectDatabaseEmulator ( db , 'localhost' , port ) ;
164
167
await get ( refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) ) ;
165
- connectDatabaseEmulator ( db , 'localhost' , 9000 ) ;
168
+ connectDatabaseEmulator ( db , 'localhost' , port ) ;
166
169
}
167
170
} ) ;
168
171
169
172
it ( 'cannot connect to emulator after network operations with different parameters' , async ( ) => {
170
173
if ( isEmulatorActive ( ) ) {
171
174
const db = getDatabase ( defaultApp ) ;
172
- connectDatabaseEmulator ( db , 'localhost' , 9000 ) ;
175
+ const port = parseInt ( EMULATOR_PORT , 10 ) ;
176
+ connectDatabaseEmulator ( db , 'localhost' , port ) ;
173
177
await get ( refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) ) ;
174
178
expect ( ( ) => {
175
179
connectDatabaseEmulator ( db , 'localhost' , 9001 ) ;
0 commit comments