Skip to content

Instantly share code, notes, and snippets.

@iainnash
Created February 27, 2019 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iainnash/04a64aa3d0b9b11d0f97747ac457f4e8 to your computer and use it in GitHub Desktop.
Save iainnash/04a64aa3d0b9b11d0f97747ac457f4e8 to your computer and use it in GitHub Desktop.
import ShallowRenderer from 'react-test-renderer/shallow';
import {TodayIntro} from './TodayIntro';
describe('TodayIntro', () => {
it('should render a hello message with a date', () => {
MockDate.set('2018-01-01');
const renderer = new ShallowRenderer();
renderer.render(<TodayIntro name="test" />);
const result = renderer.getRenderOutput();
expect(result.type).toBe('h1');
expect(result.children).toBe(['hello test, today is Jan 1']);
MockDate.reset();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment