Skip to content

Instantly share code, notes, and snippets.

View manjumuthaiya's full-sized avatar

Manju Muthaiya manjumuthaiya

  • London
View GitHub Profile
@manjumuthaiya
manjumuthaiya / enzyme-cheatsheet
Created June 24, 2016 18:37
Enzyme testing cheatsheet (jasmine-enzyme)
To debug an element :
`console.log(element.debug())`
To test the html rendered:
`expect(element.html()).toEqual('<div>content</div>');`
@manjumuthaiya
manjumuthaiya / jasmine-enzyme-cheatsheet.md
Last active July 27, 2017 20:37
Enzyme testing cheatsheet (jasmine-enzyme)

Debug an element: console.log(element.debug())

Test the html rendered: expect(element.html()).toEqual('<div>content</div>');

Find a component: element.find('ComponentName') or element.find(ComponentName) eg: expect(element.find('Component').length).toBe(1) expect(element.find('Component')).toBePresent()

Test the component prop: expect(element.find('Component')).toHaveProp('message', 'there is an error')