Skip to content

Commit f49096f

Browse files
add one more tests
1 parent 30bfc3f commit f49096f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/firestore/lite/src/api/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class Firestore implements firestore.FirebaseFirestore {
5858
throw new FirestoreError(
5959
Code.FAILED_PRECONDITION,
6060
'Firestore has already been started and its settings can no longer ' +
61-
'be changed. initializeFirestore() can only be called before calling ' +
61+
'be changed. initializeFirestore() cannot be called after calling ' +
6262
'getFirestore().'
6363
);
6464
}

packages/firestore/lite/test/integration.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,17 @@ describe('Firestore', () => {
3838
const fs2 = getFirestore(app);
3939
expect(fs1 === fs2).to.be.true;
4040
});
41+
42+
it('cannot call initializeFirestore() after getFirestore()', () => {
43+
const app = initializeApp(
44+
{ apiKey: 'fake-api-key', projectId: 'test-project' },
45+
'test-app-getFirestore-initializeFirestore'
46+
);
47+
getFirestore(app);
48+
expect(() => initializeFirestore(app, {})).to.throw(
49+
'Firestore has already been started and its settings can no longer ' +
50+
'be changed. initializeFirestore() cannot be called after calling ' +
51+
'getFirestore().'
52+
);
53+
});
4154
});

0 commit comments

Comments
 (0)