Skip to content

Commit e431c4f

Browse files
committed
Address PR comments
1 parent 1679e31 commit e431c4f

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

packages-exp/app-check-compat/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
"test:browser": "karma start --single-run --nocache"
2323
},
2424
"peerDependencies": {
25-
"@firebase/app-exp": "0.x"
25+
"@firebase/app-compat": "0.x"
2626
},
2727
"dependencies": {
28-
"@firebase/app-compat": "0.0.900",
2928
"@firebase/app-check-exp": "0.0.900",
3029
"@firebase/logger": "0.2.6",
3130
"@firebase/util": "1.1.0",
@@ -34,7 +33,6 @@
3433
},
3534
"license": "Apache-2.0",
3635
"devDependencies": {
37-
"@firebase/app-exp": "0.0.900",
3836
"rollup": "2.33.2",
3937
"@rollup/plugin-commonjs": "17.1.0",
4038
"@rollup/plugin-json": "4.1.0",

packages-exp/app-check-compat/rollup.config.release.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ const es5BuildPlugins = [
3636

3737
const es5Builds = es5BuildsNoPlugin.map(build => ({
3838
...build,
39-
plugins: es5BuildPlugins,
40-
treeshake: {
41-
moduleSideEffects: id => id === '@firebase/installations'
42-
}
39+
plugins: es5BuildPlugins
4340
}));
4441

4542
/**

packages-exp/app-check-compat/src/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,25 @@ import { FirebaseAppCheck } from '../../../packages/app-check-types';
3131

3232
declare module '@firebase/component' {
3333
interface NameServiceMapping {
34-
'app-check-compat': AppCheckService;
34+
'appCheck-compat': AppCheckService;
3535
}
3636
}
3737

38-
const factory: InstanceFactory<'app-check-compat'> = (
38+
const factory: InstanceFactory<'appCheck-compat'> = (
3939
container: ComponentContainer
4040
) => {
4141
// Dependencies
4242
const app = container.getProvider('app-compat').getImmediate();
43-
const AppCheckServiceExp = container
43+
const appCheckServiceExp = container
4444
.getProvider('app-check-exp')
4545
.getImmediate();
4646

47-
return new AppCheckService(app as FirebaseApp, AppCheckServiceExp);
47+
return new AppCheckService(app as FirebaseApp, appCheckServiceExp);
4848
};
4949

5050
export function registerAppCheck(): void {
5151
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
52-
new Component(
53-
'app-check-compat',
54-
factory,
55-
ComponentType.PUBLIC
56-
).setMultipleInstances(true)
52+
new Component('appCheck-compat', factory, ComponentType.PUBLIC)
5753
);
5854
}
5955

packages-exp/app-check-compat/src/service.test.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ import * as appCheckExp from '@firebase/app-check-exp';
2121
import { stub, match, SinonStub } from 'sinon';
2222
import * as sinonChai from 'sinon-chai';
2323
import { CustomProvider, ReCaptchaV3Provider } from '@firebase/app-check-exp';
24-
import {
25-
AppCheckToken,
26-
AppCheckTokenResult
27-
} from '../../../packages/app-check-types';
24+
import { AppCheckTokenResult } from '../../../packages/app-check-types';
2825
import { PartialObserver } from '../../../packages/util/dist';
2926

3027
use(sinonChai);
@@ -38,7 +35,7 @@ function createTestService(app: FirebaseApp): AppCheckService {
3835
);
3936
}
4037

41-
describe('Firebase Analytics > Service', () => {
38+
describe('Firebase App Check > Service', () => {
4239
let app: FirebaseApp;
4340
let service: AppCheckService;
4441

@@ -76,11 +73,19 @@ describe('Firebase Analytics > Service', () => {
7673
() => {
7774
const initializeAppCheckStub = stub(appCheckExp, 'initializeAppCheck');
7875
service = new AppCheckService(app, {} as appCheckExp.AppCheck);
76+
const customGetTokenStub = stub();
7977
service.activate({
80-
getToken: () => Promise.resolve({} as AppCheckToken)
78+
getToken: customGetTokenStub
8179
});
8280
expect(initializeAppCheckStub).to.be.calledWith(app, {
83-
provider: match.instanceOf(CustomProvider),
81+
provider: match
82+
.instanceOf(CustomProvider)
83+
.and(
84+
match.hasNested(
85+
'_customProviderOptions.getToken',
86+
customGetTokenStub
87+
)
88+
),
8489
isTokenAutoRefreshEnabled: undefined
8590
});
8691
initializeAppCheckStub.restore();

0 commit comments

Comments
 (0)