Skip to content

Commit e6a49c1

Browse files
committed
fixed the space and the rc as any problem
1 parent a7575eb commit e6a49c1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/remote-config/test/api.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ import * as sinon from 'sinon';
3737
import { Component, ComponentType } from '@firebase/component';
3838
import { FirebaseInstallations } from '@firebase/installations-types';
3939
import { openDatabase, APP_NAMESPACE_STORE } from '../src/storage/storage';
40+
import { RemoteConfig } from '@firebase/remote-config-types';
41+
import { RealtimeHandler } from '../src/client/realtime_handler';
42+
43+
interface RemoteConfigWithHandler extends RemoteConfig {
44+
_realtimeHandler: RealtimeHandler;
45+
}
4046

4147
const fakeFirebaseConfig = {
4248
apiKey: 'api-key',
@@ -91,7 +97,7 @@ describe('Remote Config API', () => {
9197
addObserver: sinon.stub<[ConfigUpdateObserver], Unsubscribe>().returns(sinon.stub()),
9298
removeObserver: sinon.stub<[ConfigUpdateObserver], Unsubscribe>().returns(sinon.stub()),
9399
};
94-
100+
95101
_addOrOverwriteComponent(
96102
app,
97103
new Component(
@@ -105,15 +111,14 @@ describe('Remote Config API', () => {
105111
ComponentType.PUBLIC
106112
) as any
107113
);
108-
mockRealtimeHandler.addObserver.resetHistory();
109-
mockRealtimeHandler.removeObserver.resetHistory();
110-
111114
});
112115

113116
afterEach(async () => {
114117
fetchStub.restore();
115118
await clearDatabase();
116119
await deleteApp(app);
120+
mockRealtimeHandler.addObserver.resetHistory();
121+
mockRealtimeHandler.removeObserver.resetHistory();
117122
});
118123

119124
function setFetchResponse(response: FetchResponse = { status: 200 }): void {
@@ -184,11 +189,9 @@ describe('Remote Config API', () => {
184189
it('should call addObserver on the realtime handler with the correct arguments', () => {
185190
const rc = getRemoteConfig(app);
186191
const addObserverStub = sinon.stub(
187-
(rc as any)._realtimeHandler,
192+
(rc as unknown as RemoteConfigWithHandler)._realtimeHandler,
188193
'addObserver'
189194
);
190-
const unsubscribeStub = sinon.stub();
191-
addObserverStub.returns(unsubscribeStub);
192195
onConfigUpdate(rc, mockObserver);
193196
expect(addObserverStub).to.have.been.calledOnceWith(mockObserver);
194197
addObserverStub.restore();
@@ -197,13 +200,12 @@ describe('Remote Config API', () => {
197200
it('should return a function that removes the observer', () => {
198201
const rc = getRemoteConfig(app);
199202
const removeObserverStub = sinon.stub(
200-
(rc as any)._realtimeHandler,
203+
(rc as unknown as RemoteConfigWithHandler)._realtimeHandler,
201204
'removeObserver'
202205
);
203206
const unsubscribe = onConfigUpdate(rc, mockObserver);
204207
unsubscribe();
205208
expect(removeObserverStub).to.have.been.calledOnceWith(mockObserver);
206209
removeObserverStub.restore();
207210
});
208-
209211
});

0 commit comments

Comments
 (0)