Skip to content

Instantly share code, notes, and snippets.

@michelts
Last active March 22, 2019 16:10
Show Gist options
  • Save michelts/fee4822a6402a8a049f2d0b9b9e71066 to your computer and use it in GitHub Desktop.
Save michelts/fee4822a6402a8a049f2d0b9b9e71066 to your computer and use it in GitHub Desktop.
import React from 'react';
import { shallow } from 'enzyme';
import { useGlobal } from 'reactn';
import Cards from './cards';
jest.mock('reactn');
it('should render a Card component for each global state card', () => {
const cards = ['Q', 'J', 'K', 'A', '2'];
useGlobal.mockReturnValueOnce([cards]);
const wrapper = shallow(<Cards />);
expect(wrapper).toMatchSnapshot();
});
it('should tell no card is selected if cards are empty', () => {
const cards = [];
useGlobal.mockReturnValueOnce([cards]);
const wrapper = shallow(<Cards />);
expect(wrapper).toMatchSnapshot();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment