diff --git a/src/background/runtime/BackgroundRuntime.ts b/src/background/runtime/BackgroundRuntime.ts index 920479e5..d1d3073b 100644 --- a/src/background/runtime/BackgroundRuntime.ts +++ b/src/background/runtime/BackgroundRuntime.ts @@ -17,7 +17,7 @@ export class BackgroundRuntime { // we try to fetch the bridge configs as soon as possible private bridgeService: BridgeService, private moduleManager: ModuleManager, - private appCheckService: AppCheckService + private appCheckService: AppCheckService, ) {} activate() { diff --git a/src/background/services/appcheck/AppCheckService.test.ts b/src/background/services/appcheck/AppCheckService.test.ts index ca82e6cd..abaa1749 100644 --- a/src/background/services/appcheck/AppCheckService.test.ts +++ b/src/background/services/appcheck/AppCheckService.test.ts @@ -44,19 +44,19 @@ describe('AppCheckService', () => { it('subscribes for events on activation correctly', () => { expect(firebaseService.addFcmMessageListener).toHaveBeenCalledWith( FcmMessageEvents.ID_CHALLENGE, - expect.any(Function) + expect.any(Function), ); expect(firebaseService.addFirebaseEventListener).toHaveBeenCalledTimes(2); expect(firebaseService.addFirebaseEventListener).toHaveBeenNthCalledWith( 1, FirebaseEvents.FCM_INITIALIZED, - expect.any(Function) + expect.any(Function), ); expect(firebaseService.addFirebaseEventListener).toHaveBeenNthCalledWith( 2, FirebaseEvents.FCM_TERMINATED, - expect.any(Function) + expect.any(Function), ); }); @@ -81,7 +81,7 @@ describe('AppCheckService', () => { { provider: expect.any(CustomProvider), isTokenAutoRefreshEnabled: true, - } + }, ); // simulate FCM_INITIALIZED event (second time) @@ -98,7 +98,7 @@ describe('AppCheckService', () => { { provider: expect.any(CustomProvider), isTokenAutoRefreshEnabled: true, - } + }, ); // simulate FCM_TERMINATED event @@ -106,7 +106,7 @@ describe('AppCheckService', () => { expect(setTokenAutoRefreshEnabled).toHaveBeenCalledWith( appCheckMock, - false + false, ); }); @@ -116,14 +116,14 @@ describe('AppCheckService', () => { // @ts-ignore firebaseService.isFcmInitialized = false; await expect( - jest.mocked(CustomProvider).mock.calls[0]?.[0].getToken() + jest.mocked(CustomProvider).mock.calls[0]?.[0].getToken(), ).rejects.toThrow('fcm is not initialized'); }); it('throws when FCM token is missing', async () => { jest.mocked(firebaseService.getFcmToken).mockReturnValueOnce(undefined); await expect( - jest.mocked(CustomProvider).mock.calls[0]?.[0].getToken() + jest.mocked(CustomProvider).mock.calls[0]?.[0].getToken(), ).rejects.toThrow('fcm token is missing'); }); diff --git a/src/background/services/appcheck/utils/challenges/basic.test.ts b/src/background/services/appcheck/utils/challenges/basic.test.ts index e86e306e..a3764d51 100644 --- a/src/background/services/appcheck/utils/challenges/basic.test.ts +++ b/src/background/services/appcheck/utils/challenges/basic.test.ts @@ -11,7 +11,7 @@ describe('basic', () => { it('throws when params are incorrect', () => { expect(() => solveBasicChallenge('{}')).toThrow( - 'invalid basic challenge details' + 'invalid basic challenge details', ); }); diff --git a/src/background/services/appcheck/utils/getHashByAlgorithm.test.ts b/src/background/services/appcheck/utils/getHashByAlgorithm.test.ts index aa5e54d0..73bed58e 100644 --- a/src/background/services/appcheck/utils/getHashByAlgorithm.test.ts +++ b/src/background/services/appcheck/utils/getHashByAlgorithm.test.ts @@ -13,7 +13,7 @@ describe('getHashByAlgorithm', () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore expect(() => getHashByAlgorithm('unknown', 'core')).toThrow( - 'unsupported algorithm "unknown"' + 'unsupported algorithm "unknown"', ); }); @@ -21,6 +21,6 @@ describe('getHashByAlgorithm', () => { 'uses the correct algorithm', (algorithm, expected) => { expect(getHashByAlgorithm(algorithm as Algorithm, 'core')).toBe(expected); - } + }, ); }); diff --git a/src/background/services/appcheck/utils/registerForChallenge.test.ts b/src/background/services/appcheck/utils/registerForChallenge.test.ts index aee0aa57..028f5fb7 100644 --- a/src/background/services/appcheck/utils/registerForChallenge.test.ts +++ b/src/background/services/appcheck/utils/registerForChallenge.test.ts @@ -27,7 +27,7 @@ describe('registerForChallenge', () => { delete process.env.ID_SERVICE_URL; expect(registerForChallenge(params)).rejects.toThrow( - 'ID_SERVICE_URL is missing' + 'ID_SERVICE_URL is missing', ); }); @@ -38,7 +38,7 @@ describe('registerForChallenge', () => { } as Response); expect(registerForChallenge(params)).rejects.toThrow( - 'challenge registration error: "internal error"' + 'challenge registration error: "internal error"', ); }); @@ -64,7 +64,7 @@ describe('registerForChallenge', () => { token: 'token', requestId: 'requestId', }), - } + }, ); }); }); diff --git a/src/background/services/appcheck/utils/registerForChallenge.ts b/src/background/services/appcheck/utils/registerForChallenge.ts index 2c6e3dd8..da8cd2e3 100644 --- a/src/background/services/appcheck/utils/registerForChallenge.ts +++ b/src/background/services/appcheck/utils/registerForChallenge.ts @@ -25,7 +25,7 @@ const registerForChallenge = async ({ token, requestId }: Params) => { if (!registerResponse.ok) { throw new Error( - `challenge registration error: "${registerResponse.statusText}"` + `challenge registration error: "${registerResponse.statusText}"`, ); } }; diff --git a/src/background/services/appcheck/utils/solveChallenge.test.ts b/src/background/services/appcheck/utils/solveChallenge.test.ts index 55ce7484..df506b7f 100644 --- a/src/background/services/appcheck/utils/solveChallenge.test.ts +++ b/src/background/services/appcheck/utils/solveChallenge.test.ts @@ -16,7 +16,7 @@ describe('solveChallenge', () => { it('solves basic challenges correctly', async () => { expect( - solveChallenge({ type: ChallengeTypes.BASIC, challengeDetails }) + solveChallenge({ type: ChallengeTypes.BASIC, challengeDetails }), ).resolves.toBe(solution); expect(solveBasicChallenge).toHaveBeenCalledWith(challengeDetails); }); diff --git a/src/background/services/appcheck/utils/verifyChallenge.test.ts b/src/background/services/appcheck/utils/verifyChallenge.test.ts index 6740f954..53986b36 100644 --- a/src/background/services/appcheck/utils/verifyChallenge.test.ts +++ b/src/background/services/appcheck/utils/verifyChallenge.test.ts @@ -27,7 +27,7 @@ describe('verifyChallenge', () => { delete process.env.ID_SERVICE_URL; expect(verifyChallenge(params)).rejects.toThrow( - 'ID_SERVICE_URL is missing' + 'ID_SERVICE_URL is missing', ); }); @@ -38,7 +38,7 @@ describe('verifyChallenge', () => { } as Response); expect(verifyChallenge(params)).rejects.toThrow( - 'challenge verification error: "internal error"' + 'challenge verification error: "internal error"', ); }); diff --git a/src/background/services/appcheck/utils/verifyChallenge.ts b/src/background/services/appcheck/utils/verifyChallenge.ts index 386c59e8..4da12062 100644 --- a/src/background/services/appcheck/utils/verifyChallenge.ts +++ b/src/background/services/appcheck/utils/verifyChallenge.ts @@ -25,7 +25,7 @@ const verifyChallenge = async ({ registrationId, solution }: Params) => { if (!verifyChallengeResponse.ok) { throw new Error( - `challenge verification error: "${verifyChallengeResponse.statusText}"` + `challenge verification error: "${verifyChallengeResponse.statusText}"`, ); } diff --git a/src/background/services/firebase/FirebaseService.test.ts b/src/background/services/firebase/FirebaseService.test.ts index 4ba25eab..61731ea0 100644 --- a/src/background/services/firebase/FirebaseService.test.ts +++ b/src/background/services/firebase/FirebaseService.test.ts @@ -35,7 +35,7 @@ describe('FirebaseService', () => { process.env = { ...realEnv, FIREBASE_CONFIG: Buffer.from(JSON.stringify({ foo: 'bar' })).toString( - 'base64' + 'base64', ), }; }); @@ -48,7 +48,7 @@ describe('FirebaseService', () => { delete process.env.FIREBASE_CONFIG; expect(() => new FirebaseService(featureFlagService)).toThrow( - 'FIREBASE_CONFIG is missing' + 'FIREBASE_CONFIG is missing', ); }); @@ -62,11 +62,11 @@ describe('FirebaseService', () => { expect(getMessaging).toHaveBeenCalledWith(appMock); expect(onBackgroundMessage).toHaveBeenCalledWith( messagingMock, - expect.any(Function) + expect.any(Function), ); expect(featureFlagService.addListener).toHaveBeenCalledWith( FeatureFlagEvents.FEATURE_FLAG_UPDATED, - expect.any(Function) + expect.any(Function), ); }); @@ -83,14 +83,14 @@ describe('FirebaseService', () => { firebaseService.addFirebaseEventListener( FirebaseEvents.FCM_INITIALIZED, - initializedEventListener + initializedEventListener, ); // simulate FEATURE_FLAG_UPDATED event await expect( jest.mocked(featureFlagService.addListener).mock.calls[0]?.[1]({ [FeatureGates.FIREBASE_CLOUD_MESSAGING]: true, - } as FeatureFlags) + } as FeatureFlags), ).resolves.toBeUndefined(); expect(firebaseService.isFcmInitialized).toBe(true); @@ -108,21 +108,21 @@ describe('FirebaseService', () => { firebaseService.addFirebaseEventListener( FirebaseEvents.FCM_TERMINATED, - terminatedEventListener + terminatedEventListener, ); // simulate FEATURE_FLAG_UPDATED event (enabled) await expect( jest.mocked(featureFlagService.addListener).mock.calls[0]?.[1]({ [FeatureGates.FIREBASE_CLOUD_MESSAGING]: true, - } as FeatureFlags) + } as FeatureFlags), ).resolves.toBeUndefined(); // simulate FEATURE_FLAG_UPDATED event (disabled) await expect( jest.mocked(featureFlagService.addListener).mock.calls[0]?.[1]({ [FeatureGates.FIREBASE_CLOUD_MESSAGING]: false, - } as FeatureFlags) + } as FeatureFlags), ).resolves.toBeUndefined(); expect(firebaseService.isFcmInitialized).toBe(false); @@ -154,7 +154,7 @@ describe('FirebaseService', () => { expect(eventListener).toHaveBeenCalledTimes(1); expect(eventListener).toHaveBeenCalledWith(messageMock); - } + }, ); }); }); diff --git a/src/background/services/firebase/FirebaseService.ts b/src/background/services/firebase/FirebaseService.ts index a2950602..57e0a42a 100644 --- a/src/background/services/firebase/FirebaseService.ts +++ b/src/background/services/firebase/FirebaseService.ts @@ -28,7 +28,7 @@ export class FirebaseService { } this.#app = initializeApp( - JSON.parse(Buffer.from(process.env.FIREBASE_CONFIG, 'base64').toString()) + JSON.parse(Buffer.from(process.env.FIREBASE_CONFIG, 'base64').toString()), ); onBackgroundMessage(getMessaging(this.#app), (payload) => { @@ -66,7 +66,7 @@ export class FirebaseService { } catch (err) { sentryCaptureException(err as Error, SentryExceptionTypes.FIREBASE); } - } + }, ); } @@ -84,7 +84,7 @@ export class FirebaseService { addFirebaseEventListener( event: FirebaseEvents, - callback: () => T + callback: () => T, ) { this.#firebaseEventEmitter.on(event, callback); } diff --git a/src/background/services/firebase/models.ts b/src/background/services/firebase/models.ts index 7206a9df..292188ba 100644 --- a/src/background/services/firebase/models.ts +++ b/src/background/services/firebase/models.ts @@ -10,5 +10,5 @@ export enum FcmMessageEvents { } export type FcmMessageListener = ( - payload: MessagePayload + payload: MessagePayload, ) => unknown | Promise;