Skip to content

Commit ab45518

Browse files
committed
Improve comments and function naming.
1 parent 05e813f commit ab45518

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/firestore/test/integration/api/database.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import {
7373
withTestDbs,
7474
withTestDoc,
7575
withTestDocAndInitialData,
76-
withNamedTestDbs
76+
withNamedTestDbsOrSkipUnlessUsingEmulator
7777
} from '../util/helpers';
7878
import { DEFAULT_SETTINGS, DEFAULT_PROJECT_ID } from '../util/settings';
7979

@@ -1710,7 +1710,7 @@ apiDescribe('Database', (persistence: boolean) => {
17101710
});
17111711

17121712
it('can keep docs separate with multi-db when online', () => {
1713-
return withNamedTestDbs(persistence, ['db1', 'db2'], async ([db1, db2]) => {
1713+
return withNamedTestDbsOrSkipUnlessUsingEmulator(persistence, ['db1', 'db2'], async ([db1, db2]) => {
17141714
const data = { name: 'Rafi', email: '[email protected]' };
17151715

17161716
const ref1 = await doc(collection(db1, 'users'), 'doc1');
@@ -1726,7 +1726,7 @@ apiDescribe('Database', (persistence: boolean) => {
17261726
});
17271727

17281728
it('can keep docs separate with multi-db when offline', () => {
1729-
return withNamedTestDbs(persistence, ['db1', 'db2'], async ([db1, db2]) => {
1729+
return withNamedTestDbsOrSkipUnlessUsingEmulator(persistence, ['db1', 'db2'], async ([db1, db2]) => {
17301730
await disableNetwork(db1);
17311731
await disableNetwork(db2);
17321732
const data = { name: 'Rafi', email: '[email protected]' };

packages/firestore/test/integration/util/helpers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,15 @@ export async function withTestDbsSettings(
203203
}
204204
}
205205

206-
export async function withNamedTestDbs(
206+
export async function withNamedTestDbsOrSkipUnlessUsingEmulator(
207207
persistence: boolean,
208208
dbNames: string[],
209209
fn: (db: Firestore[]) => Promise<void>
210210
): Promise<void> {
211-
// Named DBs requires preparing project with DBs beforehand.
212-
// Emulator does not DB to have been created beforehand.
213-
// TODO: Improve integration testing to have more than just (default) available.
211+
// Tests with named DBs can only run on emulator for now. This is because the
212+
// emulator does not require DB to be created before use.
213+
// TODO: Design ability to run named DB tests on backend. Maybe create DBs
214+
// TODO: beforehand, or create DBs as part of test setup.
214215
if (!USE_EMULATOR) {
215216
return Promise.resolve();
216217
}

0 commit comments

Comments
 (0)