Reputation: 286
I am not able to write unit test for the following code
import PushNotification from 'react-native-push-notification'
import { timeZoneForNotification } from '../Assets/Constants/constants'
import firebase from 'react-native-firebase'
export const scheduleNotification = ({
title = timeZoneForNotification.title,
message
},
date
) => {
PushNotification.localNotificationSchedule({ title, message, date })
}
Upvotes: 1
Views: 1854
Reputation: 286
Here is the way to mock
jest.mock('react-native-push-notification', () => ({
configure: jest.fn(),
onRegister: jest.fn(),
onNotification: jest.fn(),
addEventListener: jest.fn(),
requestPermissions: jest.fn()
}))
Upvotes: 2
Reputation: 595
Please add native code for notification module.
For reference:
https://github.com/react-native-community/react-native-push-notification-ios#appdelegatem
Upvotes: 0