Skip to content

Commit

Permalink
test: tidy up tests and fix remaining errors (bad mocking of expo-con…
Browse files Browse the repository at this point in the history
…stants)
  • Loading branch information
finnmerlett committed Jan 10, 2025
1 parent 9ca997d commit bf0d15b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jest.mock('@expo-google-fonts/fira-code', () => ({

jest.mock('expo-auth-session/providers/google')
jest.mock('expo-constants', () => ({
...jest.requireActual('expo-constants'),
manifest: { extra: { apiUrl: 'http://dummy.com/api' } },
}))
// jest.mock('firebase')
Expand Down
4 changes: 3 additions & 1 deletion src/components/NotificationPermissionRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export default function NotificationPermissionRequest() {
}
} else {
setPermissionGranted(false)
console.log('permissions denied, not a device')
if (typeof process.env.JEST_WORKER_ID === 'undefined') {
console.log('permissions denied, not a device') // only log if not running tests
}
}
}
async function sendPermissionRequest() {
Expand Down
4 changes: 3 additions & 1 deletion src/screens/CreateTokenScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export const CreateTokenScreen = ({ route, navigation }: Props) => {
return null
}

console.log(expoToken)
if (typeof process.env.JEST_WORKER_ID === 'undefined') {
console.log(expoToken) // only log if not running tests
}

return (
<>
Expand Down

0 comments on commit bf0d15b

Please sign in to comment.