Skip to content

Commit b58a3a8

Browse files
committed
refactor: export DEFAULT_DATABASE_ID from src/firestore/index.ts
Address review feedback: instead of duplicating the '(default)' string in 3 places, export the constant from the source module and import it in test files.
1 parent f8c269f commit b58a3a8

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/firestore/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Firestore } from '@google-cloud/firestore';
2424
import { App, getApp } from '../app';
2525
import { FirebaseApp } from '../app/firebase-app';
2626
import { FirestoreService, FirestoreSettings } from './firestore-internal';
27-
const DEFAULT_DATABASE_ID = '(default)';
27+
export const DEFAULT_DATABASE_ID = '(default)';
2828

2929
export {
3030
AddPrefixToKeys,

test/unit/firestore/firestore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from '../../../src/app/credential-internal';
2929
import { FirestoreService, getFirestoreOptions } from '../../../src/firestore/firestore-internal';
3030
import { getSdkVersion } from '../../../src/utils/index';
31-
const DEFAULT_DATABASE_ID = '(default)';
31+
import { DEFAULT_DATABASE_ID } from '../../../src/firestore/index';
3232

3333
describe('Firestore', () => {
3434
let mockApp: FirebaseApp;

test/unit/firestore/index.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import * as chaiAsPromised from 'chai-as-promised';
2323

2424
import * as mocks from '../../resources/mocks';
2525
import { App } from '../../../src/app/index';
26-
import { getFirestore, initializeFirestore, Firestore } from '../../../src/firestore/index';
27-
const DEFAULT_DATABASE_ID = '(default)';
26+
import { getFirestore, initializeFirestore, Firestore, DEFAULT_DATABASE_ID } from '../../../src/firestore/index';
2827

2928
chai.should();
3029
chai.use(sinonChai);

0 commit comments

Comments
 (0)