Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Nov 14, 2024
1 parent 5e438b4 commit 4667063
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
22 changes: 22 additions & 0 deletions packages/app/__tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,27 @@ describe('App', function () {
// Restore the original console.warn
consoleWarnSpy.mockRestore();
});

it('FirebaseApp.toString()', function () {
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const app = firebase.app();
app.toString();
// Check that console.warn was called for deprecated method call
firebase.setLogLevel('debug');
expect(consoleWarnSpy).toHaveBeenCalled();
// Restore the original console.warn
consoleWarnSpy.mockRestore();
});

it('FirebaseApp.extendApp()', function () {
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const app = firebase.app();
// To overcome type assertion
(app as any).extendApp({ some: 'property' });
// Check that console.warn was called for deprecated method call
expect(consoleWarnSpy).toHaveBeenCalled();
// Restore the original console.warn
consoleWarnSpy.mockRestore();
});
});
});
11 changes: 5 additions & 6 deletions packages/app/lib/FirebaseApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ export default class FirebaseApp {
}

extendApp(extendedProps) {
if (isNotModularCall(arguments)) {
// eslint-disable-next-line no-console
console.warn(
'This v8 method is deprecated and will be removed in the next major release as part of move to match Firebase Web modular v9 SDK API.',
);
}
// eslint-disable-next-line no-console
console.warn(
'This v8 method is deprecated and will be removed in the next major release as part of move to match Firebase Web modular v9 SDK API.',
);

this._checkDestroyed();
Object.assign(this, extendedProps);
}
Expand Down

0 comments on commit 4667063

Please sign in to comment.