Answers for "enzyme examples"

3

what enzyme

hmmm tasty
Posted by: Guest on March-19-2021
0

enzyme at example

// dom.js

import React from 'react'

const DomTest = () => (
  <div>
    <div className='parentSatu'>
      <p className='childSatu'>hello wordl satu</p>
    </div>
    <div className='parentDua'>
      <p className='childDua'>hello wordl dua</p>
    </div>
    <div className='parentTiga'>
      <p className='childTiga'>hello wordl tiga</p>
    </div>

    <div className='domGroup'>
      <p className='domSatu satu'>DOM Satu</p>
      <p className='domDua'>DOM Dua</p>
      <p className='domTiga'>DOM Tiga</p>
    </div>

    <h1 className='header'>
      <span className='sub-header'>Hello World</span>
    </h1>
  </div>
)

export default DomTest

// dom.test.js

test('find element in DomTest Component by index using at', () => {
    expect(wrapper.find('.domGroup').children().at(0).text()).toStrictEqual('DOM Satu')
    expect(wrapper.find('.domGroup').children().at(1).text()).toStrictEqual('DOM Dua')
    expect(wrapper.find('.domGroup').children().at(2).text()).toStrictEqual('DOM Tiga')
  })
Posted by: Guest on November-21-2020
0

react enzyme

step by step how to fix enzyme-adapter-react-16  not support for React version 17


step one : npm i npm-install-peers -g
step two copy this : 
"peerDependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1"
}
step three: typing in your terminal npm-install-peers
Posted by: Guest on November-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language