Skip to content

Commit acc8059

Browse files
committed
fix lint
1 parent 3c4183a commit acc8059

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Mobile-Expensify

tests/unit/hooks/useRestoreWorkspacesTabOnNavigate.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ jest.mock('@libs/PolicyUtils', () => ({
5757
const fakePolicyID = 'ABCD1234';
5858
const mockPolicy = {...createRandomPolicy(0), id: fakePolicyID};
5959
const mockedGetPathFromState = getPathFromState as jest.MockedFunction<typeof getPathFromState>;
60-
const mockedGetRootState = navigationRef.getRootState as jest.Mock;
60+
/* eslint-disable @typescript-eslint/unbound-method -- jest.fn() mocks don't rely on `this` binding */
61+
const mockedGetRootState = navigationRef.getRootState as unknown as jest.Mock<{routes: unknown[]} | undefined>;
62+
const mockedDispatch = jest.mocked(navigationRef.dispatch);
63+
/* eslint-enable @typescript-eslint/unbound-method */
6164

6265
const useRestoreWorkspacesTabOnNavigate = (require('@hooks/useRestoreWorkspacesTabOnNavigate') as {default: () => () => void}).default;
6366

@@ -237,7 +240,7 @@ describe('useRestoreWorkspacesTabOnNavigate', () => {
237240

238241
// The older TabNavigator is reached via StackActions.pop (popping the newer empty one off the root stack),
239242
// not via a fresh Navigation.navigate. Verify dispatch was called with a POP action.
240-
expect(navigationRef.dispatch).toHaveBeenCalledWith(expect.objectContaining({type: 'POP'}));
243+
expect(mockedDispatch).toHaveBeenCalledWith(expect.objectContaining({type: 'POP'}));
241244
expect(Navigation.navigate).not.toHaveBeenCalled();
242245
});
243246

0 commit comments

Comments
 (0)