Files
wallet/apps/mobile/jest-setup.js
zeekay 01c9bc491d chore: scrub uniswap — use @luxamm/* (lux fork) only
Replace every @uniswap/* package import with @luxamm/* (lux fork
already canonical for SDK pieces). Replace app.uniswap.org URLs with
lux.exchange, uniswap.org with lux.network. Replace brand strings
(Uniswap Wallet → Lux Wallet, Uniswap Extension → Lux Extension,
Uniswap Labs → Lux Labs Inc.) where they appear in user-facing UI.
Rename handleUniswapAppDeepLink → handleLuxAppDeepLink, also rename
focusOrCreateUniswapInterfaceTab → focusOrCreateLuxInterfaceTab.

Manifest host_permissions updated to lux.exchange and *.lux.network.

Lockfile regeneration: TODO — run pnpm install to refresh after this
commit. Transitive @uniswap/* references in pnpm-lock.yaml are
upstream-package internals.

Protocol-level identifiers (UniswapMethodHandler, UniswapMethods,
UniswapOpenSidebarRequest, handleUniswapX, UniswapXOrderDetails) are
preserved because they reference wire-protocol method names
(uniswap_openSidebar) and external SDK type exports — renaming would
break upstream contracts. iOS Uniswap target directory and
uniswapteam.slack.com / github.com/Uniswap/universe doc refs are
out-of-scope per directive (separate native-build cleanup).

Same hard-banishment rule as tamagui (per feedback memory).
2026-06-10 22:35:41 -07:00

127 lines
3.5 KiB
JavaScript

// From https://reactnavigation.org/docs/testing/#setting-up-jest
import 'react-native-gesture-handler/jestSetup'
// Other
import 'core-js' // necessary so setImmediate works in tests
import 'utilities/jest-package-mocks'
import 'uniswap/jest-package-mocks'
import 'wallet/jest-package-mocks'
import 'config/jest-presets/ui/ui-package-mocks'
import '@l.x/lx/src/i18n' // Uses real translations for tests
import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock.js'
import { setUpTests } from 'react-native-reanimated'
setUpTests()
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
jest.mock('react-native/Libraries/Animated/NativeAnimatedModule')
jest.mock('@luxamm/client-explore/dist/uniswap/explore/v1/service-ExploreStatsService_connectquery', () => {})
jest.mock('@walletconnect/react-native-compat', () => ({}))
// Mock OneSignal package
jest.mock('react-native-onesignal', () => {
return {
OneSignal: {
Debug: {
setLogLevel: jest.fn(),
},
initialize: jest.fn(),
Notifications: {
addEventListener: jest.fn(),
requestPermission: jest.fn(),
},
User: {
addTag: jest.fn(),
addTags: jest.fn(),
getOnesignalId: jest.fn(() => 'dummyUserId'),
pushSubscription: {
getTokenAsync: jest.fn(() => 'dummyPushToken'),
},
},
},
}
})
jest.mock('react-native-appsflyer', () => {
return {
initSdk: jest.fn(),
}
})
jest.mock('react-native-permissions', () => ({}))
// NetInfo mock does not export typescript types
const NetInfoStateType = {
unknown: 'unknown',
none: 'none',
cellular: 'cellular',
wifi: 'wifi',
bluetooth: 'bluetooth',
ethernet: 'ethernet',
wimax: 'wimax',
vpn: 'vpn',
other: 'other',
}
jest.mock('@react-native-community/netinfo', () => ({ ...mockRNCNetInfo, NetInfoStateType }))
// from https://github.com/facebook/react-native/issues/28839#issuecomment-625453688
jest.mock('react-native', () => {
const RN = jest.requireActual('react-native') // use original implementation, which comes with mocks out of the box
// Mock Linking module within React Native
RN.Linking = {
openURL: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
canOpenURL: jest.fn(),
getInitialURL: jest.fn(),
}
// Mock Share module within React Native
RN.Share = {
share: jest.fn(),
sharedAction: 'sharedAction',
dismissedAction: 'dismissedAction',
}
return RN
})
jest.mock('@react-navigation/elements', () => ({
useHeaderHeight: jest.fn().mockImplementation(() => 200),
}))
require('react-native-reanimated').setUpTests()
jest.mock('@react-native-firebase/auth', () => () => ({
signInAnonymously: jest.fn(),
}))
jest.mock('react-native-bootsplash', () => {
return {
hide: jest.fn().mockResolvedValue(),
isVisible: jest.fn().mockResolvedValue(false),
useHideAnimation: jest.fn().mockReturnValue({
container: {},
logo: { source: 0 },
brand: { source: 0 },
}),
}
})
jest.mock('react-native-keyboard-controller', () => require('react-native-keyboard-controller/jest'))
// Mock @gorhom/bottom-sheet with plain View components
jest.mock('@gorhom/bottom-sheet', () => {
const reactNative = jest.requireActual('react-native')
const { View } = reactNative
return {
__esModule: true,
default: View,
BottomSheetModal: View,
BottomSheetModalProvider: View,
BottomSheetView: View,
}
})