Skip to content

Commit 960d97e

Browse files
committed
fix some tests
1 parent 6acda9b commit 960d97e

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

integration/shared/namespaceDefinition.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@
5555
"removeApp": {
5656
"__type": "function"
5757
},
58-
"components": {
59-
"__type": "Map"
60-
},
6158
"ErrorFactory": {
6259
"__type": "function"
6360
},

packages/app/src/compat/firebaseApp.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
_FirebaseNamespace,
2222
FirebaseService
2323
} from '@firebase/app-types/private';
24-
import { Component, ComponentType, Name } from '@firebase/component';
24+
import { Component, ComponentType, Name, ComponentContainer } from '@firebase/component';
2525
import { DEFAULT_ENTRY_NAME } from '../constants';
2626
import { FirebaseAppInternalNext } from '@firebase/app-types/next';
2727
import { deleteApp } from '../next';
@@ -32,12 +32,15 @@ import { addComponent, addOrOverwriteComponent } from '../next/internal';
3232
* a shared authentication state.
3333
*/
3434
export class FirebaseAppImpl implements FirebaseApp {
35+
private readonly container: ComponentContainer;
36+
3537
constructor(
3638
private readonly app: FirebaseAppInternalNext,
3739
private readonly firebase: _FirebaseNamespace
3840
) {
3941
// add itself to container
4042
addComponent(app, new Component('app', () => this, ComponentType.PUBLIC));
43+
this.container = app.container;
4144
}
4245

4346
get automaticDataCollectionEnabled(): boolean {

packages/app/src/next/api.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ describe('API tests', () => {
141141
});
142142

143143
describe('deleteApp', () => {
144-
it('marks an App as deleted', () => {
144+
it('marks an App as deleted', async () => {
145145
const app = initializeApp({});
146146
expect((app as FirebaseAppInternalNext).isDeleted).to.be.false;
147147

148-
deleteApp(app).catch(() => {});
148+
await deleteApp(app).catch(() => {});
149149
expect((app as FirebaseAppInternalNext).isDeleted).to.be.true;
150150
});
151151

packages/app/src/next/api.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,13 @@ export function getApps(): FirebaseAppNext[] {
9595
return Array.from(apps.values());
9696
}
9797

98-
export function deleteApp(app: FirebaseAppNext): Promise<void> {
98+
export async function deleteApp(app: FirebaseAppNext): Promise<void> {
9999
const name = app.name;
100100
if (apps.has(name)) {
101101
apps.delete(name);
102+
await (app as FirebaseAppInternalNext).container.getProviders().map(provider => provider.delete());
102103
(app as FirebaseAppInternalNext).isDeleted = true;
103-
// TODO: what to do with other SDKs?
104104
}
105-
106-
return Promise.resolve();
107105
}
108106

109107
export function registerVersion(

0 commit comments

Comments
 (0)