Skip to content

Instantly share code, notes, and snippets.

@darde
Last active February 22, 2020 23:04
Show Gist options
  • Save darde/da5cfe48b48a7c5878140862d2d5bdad to your computer and use it in GitHub Desktop.
Save darde/da5cfe48b48a7c5878140862d2d5bdad to your computer and use it in GitHub Desktop.
Medium store - Testing asynchronous code with Jest and Testing Library React - src/services/fetchPosts.js
import axios from 'axios';
const BASE_URL = 'https://jsonplaceholder.typicode.com/posts';
export default async () => {
const response = await axios.get(BASE_URL);
return response.data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment