Skip to content

Commit

Permalink
[TS migration] Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-rebelo committed Feb 9, 2024
1 parent 98e87c6 commit 989a2a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions __mocks__/react-native-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {ValueOf} from 'type-fest';
type Results = ValueOf<typeof RESULTS>;
type ResultsCollection = Record<string, Results>;
type NotificationSettings = Record<string, boolean>;
type Notification = {status: Results; settings: typeof notificationSettings}

const openLimitedPhotoLibraryPicker: jest.Mock<void> = jest.fn(() => {});
const openSettings: jest.Mock<void> = jest.fn(() => {});
Expand All @@ -25,12 +26,12 @@ const notificationSettings: NotificationSettings = {
notificationCenter: true,
};

const checkNotifications: jest.Mock<{status: Results; settings: typeof notificationSettings}> = jest.fn(() => ({
const checkNotifications: jest.Mock<Notification> = jest.fn(() => ({
status: RESULTS.GRANTED,
settings: notificationSettings,
}));

const requestNotifications: jest.Mock<{status: Results; settings: typeof notificationSettings}> = jest.fn((options: Record<string, string>) => ({
const requestNotifications: jest.Mock<Notification> = jest.fn((options: Record<string, string>) => ({
status: RESULTS.GRANTED,
settings: Object.keys(options)
.filter((option: string) => notificationOptions.includes(option))
Expand Down

0 comments on commit 989a2a7

Please sign in to comment.