Skip to content

Commit

Permalink
Enable integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DellaBitta committed Feb 7, 2025
1 parent a04b531 commit 1eab9b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions packages/database/test/exp/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
orderByKey
} from '../../src/api/Reference_impl';
import {
connectDatabaseEmulator,
getDatabase,
goOffline,
goOnline,
Expand All @@ -46,8 +47,10 @@ import { EventAccumulatorFactory } from '../helpers/EventAccumulator';
import {
DATABASE_ADDRESS,
DATABASE_URL,
EMULATOR_PORT,
getFreshRepo,
getRWRefs,
USE_EMULATOR,
waitFor,
waitUntil,
writeAndValidate
Expand Down Expand Up @@ -138,15 +141,15 @@ describe('Database@exp Tests', () => {
unsubscribe();
});

/*it('can connected to emulator', async () => {
if (isEmulatorActive()) {
it('can connected to emulator', async () => {
if (USE_EMULATOR) {
const db = getDatabase(defaultApp);
connectDatabaseEmulator(db, 'localhost', parseInt(EMULATOR_PORT, 10));
await get(refFromURL(db, `${DATABASE_ADDRESS}/foo/bar`));
}
});
it('can chnage emulator config before network operations', async () => {
if (isEmulatorActive()) {
if (USE_EMULATOR) {
const db = getDatabase(defaultApp);
const port = parseInt(EMULATOR_PORT, 10);
connectDatabaseEmulator(db, 'localhost', port + 1);
Expand All @@ -155,7 +158,7 @@ describe('Database@exp Tests', () => {
}
});
it('can connected to emulator after network operations with same parameters', async () => {
if (isEmulatorActive()) {
if (USE_EMULATOR) {
const db = getDatabase(defaultApp);
const port = parseInt(EMULATOR_PORT, 10);
connectDatabaseEmulator(db, 'localhost', port);
Expand All @@ -164,7 +167,7 @@ describe('Database@exp Tests', () => {
}
});
it('cannot connect to emulator after network operations with different parameters', async () => {
if (isEmulatorActive()) {
if (USE_EMULATOR) {
const db = getDatabase(defaultApp);
const port = parseInt(EMULATOR_PORT, 10);
connectDatabaseEmulator(db, 'localhost', port);
Expand All @@ -174,7 +177,6 @@ describe('Database@exp Tests', () => {
}).to.throw();
}
});
*/

it('can properly handle unknown deep merges', async () => {
// Note: This test requires `testIndex` to be added as an index.
Expand Down
4 changes: 2 additions & 2 deletions packages/database/test/helpers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import { EventAccumulator } from './EventAccumulator';

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

let freshRepoId = 0;
const activeFreshApps: FirebaseApp[] = [];
Expand Down

0 comments on commit 1eab9b4

Please sign in to comment.