diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 780f3e9a216..23e66aa2ad3 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -1915,21 +1915,6 @@ "count": 1 } }, - "packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts": { - "@typescript-eslint/explicit-function-return-type": { - "count": 3 - } - }, - "packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts": { - "@typescript-eslint/explicit-function-return-type": { - "count": 2 - } - }, - "packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts": { - "@typescript-eslint/explicit-function-return-type": { - "count": 4 - } - }, "packages/notification-services-controller/src/NotificationServicesPushController/services/services.ts": { "@typescript-eslint/naming-convention": { "count": 1 diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts b/packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts index 3395c3de88b..9b83fca11b4 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts @@ -8,7 +8,7 @@ type MockResponse = { export const MOCK_REG_TOKEN = 'REG_TOKEN'; -export const getMockUpdatePushNotificationLinksResponse = () => { +export const getMockUpdatePushNotificationLinksResponse = (): MockResponse => { return { url: REGISTRATION_TOKENS_ENDPOINT(), requestMethod: 'POST', @@ -27,7 +27,7 @@ export const MOCK_FCM_RESPONSE = { }, }; -export const getMockCreateFCMRegistrationTokenResponse = () => { +export const getMockCreateFCMRegistrationTokenResponse = (): MockResponse => { return { url: /^https:\/\/fcmregistrations\.googleapis\.com\/v1\/projects\/.*$/u, requestMethod: 'POST', @@ -35,7 +35,7 @@ export const getMockCreateFCMRegistrationTokenResponse = () => { } satisfies MockResponse; }; -export const getMockDeleteFCMRegistrationTokenResponse = () => { +export const getMockDeleteFCMRegistrationTokenResponse = (): MockResponse => { return { url: /^https:\/\/fcmregistrations\.googleapis\.com\/v1\/projects\/.*$/u, requestMethod: 'POST', diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts b/packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts index 34a1b7c3c8c..d5d432c2720 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts @@ -6,8 +6,8 @@ const PUSH_API_ENV = { prd: 'https://push.api.cx.metamask.io', } satisfies Record; -export const PUSH_API = (env: ENV = 'prd') => +export const PUSH_API = (env: ENV = 'prd'): string => PUSH_API_ENV[env] ?? PUSH_API_ENV.prd; -export const REGISTRATION_TOKENS_ENDPOINT = (env: ENV = 'prd') => +export const REGISTRATION_TOKENS_ENDPOINT = (env: ENV = 'prd'): string => `${PUSH_API(env)}/api/v2/token`; diff --git a/packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts b/packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts index 4fd8089a195..69c3de3a2b5 100644 --- a/packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts @@ -9,7 +9,7 @@ import { mockEndpointUpdatePushNotificationLinks } from '../__fixtures__/mockSer import type { PushNotificationEnv } from '../types/firebase'; // Testing util to clean up verbose logs when testing errors -const mockErrorLog = () => +const mockErrorLog = (): jest.SpyInstance => jest.spyOn(log, 'error').mockImplementation(jest.fn()); const MOCK_REG_TOKEN = 'REG_TOKEN'; @@ -19,7 +19,7 @@ const MOCK_JWT = 'MOCK_JWT'; describe('NotificationServicesPushController Services', () => { describe('updateLinksAPI', () => { - const act = async () => + const act = async (): Promise => await updateLinksAPI({ bearerToken: MOCK_JWT, addresses: MOCK_ADDRESSES, @@ -54,6 +54,8 @@ describe('NotificationServicesPushController Services', () => { }); describe('activatePushNotifications', () => { + // Internal testing utility - return type is inferred + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const arrangeMocks = (override?: { mockPut?: { status: number } }) => { const params = { bearerToken: MOCK_JWT, @@ -124,6 +126,8 @@ describe('NotificationServicesPushController Services', () => { }); describe('deactivatePushNotifications', () => { + // Internal testing utility - return type is inferred + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const arrangeMocks = () => { const params = { regToken: MOCK_REG_TOKEN,