Skip to content

Instantly share code, notes, and snippets.

View dilantha111's full-sized avatar

Dilantha dilantha111

View GitHub Profile
import React, { useState } from 'react';
import { getMetalGenres } from './services/music-genres';
import './App.css';
function App() {
const [genreList, setGenreList] = useState(null);
const [error, setError] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const handleFetchMetal = async () => {
import React from 'react';
import { shallow, mount, render, act } from 'enzyme';
import { getMetalGenres } from './services/music-genres';
import App from './App';
jest.mock('./services/music-genres');
describe("App component", () => {
const genreList = [
"Gothic Metal",
@dilantha111
dilantha111 / App.test.js
Created August 24, 2020 17:43
With React testing library, but not that good way
import React from 'react';
import { render, fireEvent, waitFor, waitForElement, wait, waitForDomChange } from '@testing-library/react';
import { getMetalGenres } from './services/music-genres';
import App from './App';
jest.mock('./services/music-genres');
describe("App component", () => {
let utils;
const genreList = [