Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I want to mock get Token inside the mocked function in test case by calling from the child component
- onLocationSubmit = async (start, end) => {
- try {
- this.setState({ token: false, isLoader: true, errorMessage: "", routeDetail: {}, path: [] });
- const response = await getToken({ start, end });
- if (response && response.data && response.data.token) {
- this.setState({ token: response.data.token }, () => {
- this.getDirectionPath();
- });
- }
- } catch (error) {
- this.setState({ errorMessage: error.response.data, isLoader: false });
- }
- };
- onFormSubmit = event => {
- event.preventDefault();
- const { onSubmitSearch } = this.props;
- const { origin, destination } = this.state;
- onSubmitSearch(origin, destination);
- this.setState({ isSubmit: true });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement