Skip to content

Commit 1eab9b4

Browse files
committed
Enable integration tests
1 parent a04b531 commit 1eab9b4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/database/test/exp/integration.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
orderByKey
3636
} from '../../src/api/Reference_impl';
3737
import {
38+
connectDatabaseEmulator,
3839
getDatabase,
3940
goOffline,
4041
goOnline,
@@ -46,8 +47,10 @@ import { EventAccumulatorFactory } from '../helpers/EventAccumulator';
4647
import {
4748
DATABASE_ADDRESS,
4849
DATABASE_URL,
50+
EMULATOR_PORT,
4951
getFreshRepo,
5052
getRWRefs,
53+
USE_EMULATOR,
5154
waitFor,
5255
waitUntil,
5356
writeAndValidate
@@ -138,15 +141,15 @@ describe('Database@exp Tests', () => {
138141
unsubscribe();
139142
});
140143

141-
/*it('can connected to emulator', async () => {
142-
if (isEmulatorActive()) {
144+
it('can connected to emulator', async () => {
145+
if (USE_EMULATOR) {
143146
const db = getDatabase(defaultApp);
144147
connectDatabaseEmulator(db, 'localhost', parseInt(EMULATOR_PORT, 10));
145148
await get(refFromURL(db, `${DATABASE_ADDRESS}/foo/bar`));
146149
}
147150
});
148151
it('can chnage emulator config before network operations', async () => {
149-
if (isEmulatorActive()) {
152+
if (USE_EMULATOR) {
150153
const db = getDatabase(defaultApp);
151154
const port = parseInt(EMULATOR_PORT, 10);
152155
connectDatabaseEmulator(db, 'localhost', port + 1);
@@ -155,7 +158,7 @@ describe('Database@exp Tests', () => {
155158
}
156159
});
157160
it('can connected to emulator after network operations with same parameters', async () => {
158-
if (isEmulatorActive()) {
161+
if (USE_EMULATOR) {
159162
const db = getDatabase(defaultApp);
160163
const port = parseInt(EMULATOR_PORT, 10);
161164
connectDatabaseEmulator(db, 'localhost', port);
@@ -164,7 +167,7 @@ describe('Database@exp Tests', () => {
164167
}
165168
});
166169
it('cannot connect to emulator after network operations with different parameters', async () => {
167-
if (isEmulatorActive()) {
170+
if (USE_EMULATOR) {
168171
const db = getDatabase(defaultApp);
169172
const port = parseInt(EMULATOR_PORT, 10);
170173
connectDatabaseEmulator(db, 'localhost', port);
@@ -174,7 +177,6 @@ describe('Database@exp Tests', () => {
174177
}).to.throw();
175178
}
176179
});
177-
*/
178180

179181
it('can properly handle unknown deep merges', async () => {
180182
// Note: This test requires `testIndex` to be added as an index.

packages/database/test/helpers/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ import { EventAccumulator } from './EventAccumulator';
3333

3434
// eslint-disable-next-line @typescript-eslint/no-require-imports
3535
export const TEST_PROJECT = require('../../../../config/project.json');
36-
const EMULATOR_PORT = process.env.RTDB_EMULATOR_PORT;
36+
export const EMULATOR_PORT = process.env.RTDB_EMULATOR_PORT;
3737
const EMULATOR_NAMESPACE = process.env.RTDB_EMULATOR_NAMESPACE;
38-
const USE_EMULATOR = !!EMULATOR_PORT;
38+
export const USE_EMULATOR = !!EMULATOR_PORT;
3939

4040
let freshRepoId = 0;
4141
const activeFreshApps: FirebaseApp[] = [];

0 commit comments

Comments
 (0)