I am writing unit tests for react native app using jest and enzyme. When I try to run the test cases I get the following error:
● Test suite failed to run
TypeError: Cannot read property 'SHORT' of undefined
at Object. (node_modules/react-native-simple-toast/index.js:7:23) at Object. (src/client/components/Catalogue/events.js:10:29) at Object. (tests/events-test.js:5:13) at Generator.next () at new Promise () at Generator.next () at
The error is due to importing Toast from react-native-simple-toast. Without this import the test runs fine, but I need react-native-simple-toast in my component and hence cannot remove it.I somehow need the test to run with react-native-simple-toast in my component:
import React, { Component } from 'react'
import { Platform, ActivityIndicator, Linking, Dimensions, View, Text,
TouchableOpacity, TextInput, StyleSheet, Keyboard, Image,
KeyboardAvoidingView } from 'react-native'
import { Container, Header, Card, CardItem, Content, Left, Right, Body,
Title, Icon, Button } from 'native-base';
import IconIOSback from 'react-native-vector-icons/Ionicons';
import IconMenu from 'react-native-vector-icons/MaterialIcons';
import axios from 'axios';
import SERVER_URL from '../../config';
import { Col, Row, Grid } from 'react-native-easy-grid';
import Toast from 'react-native-simple-toast'; //this causes the error
Kindly, help me resolve this issue.