Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions __mocks__/react-native-permissions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import {PERMISSIONS, RESULTS} from 'react-native-permissions/dist/commonjs/permissions';
import {PERMISSIONS} from 'react-native-permissions/dist/commonjs/permissions';
import type {ValueOf} from 'type-fest';

const RESULTS = {
UNAVAILABLE: 'unavailable',
BLOCKED: 'blocked',
DENIED: 'denied',
GRANTED: 'granted',
LIMITED: 'limited',
} as const;

type Results = ValueOf<typeof RESULTS>;
type ResultsCollection = Record<string, Results>;
type NotificationSettings = Record<string, boolean>;
type Notification = {status: Results; settings: NotificationSettings};

const openLimitedPhotoLibraryPicker: jest.Mock<void> = jest.fn(() => {});
const openSettings: jest.Mock<void> = jest.fn(() => {});
const check = jest.fn(() => RESULTS.GRANTED as string);
const request = jest.fn(() => RESULTS.GRANTED as string);
const check = jest.fn(() => Promise.resolve(RESULTS.GRANTED as string));
const request = jest.fn(() => Promise.resolve(RESULTS.GRANTED as string));
const checkLocationAccuracy: jest.Mock<string> = jest.fn(() => 'full');
const requestLocationAccuracy: jest.Mock<string> = jest.fn(() => 'full');

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/SessionTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {createRandomReport} from '../utils/collections/reports';
import * as TestHelper from '../utils/TestHelper';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
import waitForBatchedUpdatesWithAct from '../utils/waitForBatchedUpdatesWithAct';
import waitForNetworkPromises from '../utils/waitForNetworkPromises';

Expand Down Expand Up @@ -117,7 +116,7 @@ describe('Deep linking', () => {
Linking.setInitialURL(url);
const {unmount} = render(<App />);

await waitForBatchedUpdates();
await waitForBatchedUpdatesWithAct();

expect(lastVisitedPath).toBe(`/${ROUTES.REPORT}/${report.reportID}`);

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/components/IOURequestStepConfirmationPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jest.mock('@libs/Navigation/Navigation', () => {
navigate: jest.fn(),
goBack: jest.fn(),
dismissModalWithReport: jest.fn(),
setNavigationActionToMicrotaskQueue: jest.fn((callback: () => void) => callback()),
navigationRef: mockRef,
};
});
Expand Down Expand Up @@ -1263,6 +1264,7 @@ describe('IOURequestStepConfirmationPageTest', () => {

await waitForBatchedUpdatesWithAct();
fireEvent.press(await screen.findByText(/^Create .*expense/i));
await waitForBatchedUpdatesWithAct();

// Unreported distance requests should skip createDistanceRequest and use requestMoney
expect(IOU.createDistanceRequest).not.toHaveBeenCalled();
Expand Down
Loading