@@ -35,6 +35,7 @@ import {
35
35
orderByKey
36
36
} from '../../src/api/Reference_impl' ;
37
37
import {
38
+ connectDatabaseEmulator ,
38
39
getDatabase ,
39
40
goOffline ,
40
41
goOnline ,
@@ -46,8 +47,10 @@ import { EventAccumulatorFactory } from '../helpers/EventAccumulator';
46
47
import {
47
48
DATABASE_ADDRESS ,
48
49
DATABASE_URL ,
50
+ EMULATOR_PORT ,
49
51
getFreshRepo ,
50
52
getRWRefs ,
53
+ USE_EMULATOR ,
51
54
waitFor ,
52
55
waitUntil ,
53
56
writeAndValidate
@@ -138,15 +141,15 @@ describe('Database@exp Tests', () => {
138
141
unsubscribe ( ) ;
139
142
} ) ;
140
143
141
- /* it('can connected to emulator', async () => {
142
- if (isEmulatorActive() ) {
144
+ it ( 'can connected to emulator' , async ( ) => {
145
+ if ( USE_EMULATOR ) {
143
146
const db = getDatabase ( defaultApp ) ;
144
147
connectDatabaseEmulator ( db , 'localhost' , parseInt ( EMULATOR_PORT , 10 ) ) ;
145
148
await get ( refFromURL ( db , `${ DATABASE_ADDRESS } /foo/bar` ) ) ;
146
149
}
147
150
} ) ;
148
151
it ( 'can chnage emulator config before network operations' , async ( ) => {
149
- if (isEmulatorActive() ) {
152
+ if ( USE_EMULATOR ) {
150
153
const db = getDatabase ( defaultApp ) ;
151
154
const port = parseInt ( EMULATOR_PORT , 10 ) ;
152
155
connectDatabaseEmulator ( db , 'localhost' , port + 1 ) ;
@@ -155,7 +158,7 @@ describe('Database@exp Tests', () => {
155
158
}
156
159
} ) ;
157
160
it ( 'can connected to emulator after network operations with same parameters' , async ( ) => {
158
- if (isEmulatorActive() ) {
161
+ if ( USE_EMULATOR ) {
159
162
const db = getDatabase ( defaultApp ) ;
160
163
const port = parseInt ( EMULATOR_PORT , 10 ) ;
161
164
connectDatabaseEmulator ( db , 'localhost' , port ) ;
@@ -164,7 +167,7 @@ describe('Database@exp Tests', () => {
164
167
}
165
168
} ) ;
166
169
it ( 'cannot connect to emulator after network operations with different parameters' , async ( ) => {
167
- if (isEmulatorActive() ) {
170
+ if ( USE_EMULATOR ) {
168
171
const db = getDatabase ( defaultApp ) ;
169
172
const port = parseInt ( EMULATOR_PORT , 10 ) ;
170
173
connectDatabaseEmulator ( db , 'localhost' , port ) ;
@@ -174,7 +177,6 @@ describe('Database@exp Tests', () => {
174
177
} ) . to . throw ( ) ;
175
178
}
176
179
} ) ;
177
- */
178
180
179
181
it ( 'can properly handle unknown deep merges' , async ( ) => {
180
182
// Note: This test requires `testIndex` to be added as an index.
0 commit comments