Skip to content

Commit a6796da

Browse files
committed
Add test, update error message
1 parent 0036cf8 commit a6796da

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/app/src/api.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ describe('API tests', () => {
206206
it('throws retrieving a non existing App (default name)', () => {
207207
expect(() => getApp()).throws(/No Firebase App/);
208208
});
209+
210+
it('does not throw on a non existing App (default name) if a defaults object exists', () => {
211+
global.__FIREBASE_DEFAULTS__ = { config: { apiKey: 'abcd' } };
212+
const app = getApp();
213+
expect(app.options.apiKey).to.equal('abcd');
214+
global.__FIREBASE_DEFAULTS__ = undefined;
215+
});
209216
});
210217

211218
describe('getApps', () => {

packages/app/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const enum AppError {
3434
const ERRORS: ErrorMap<AppError> = {
3535
[AppError.NO_APP]:
3636
"No Firebase App '{$appName}' has been created - " +
37-
'call initializeApp()',
37+
'call initializeApp() first',
3838
[AppError.BAD_APP_NAME]: "Illegal App name: '{$appName}",
3939
[AppError.DUPLICATE_APP]:
4040
"Firebase App named '{$appName}' already exists with different options or config",

0 commit comments

Comments
 (0)