jeudi 4 juillet 2019

How will i check if some class or some node is present in component?

Hi I have a component tripDetails and its associate test file

import React from 'react';
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import tripDetails from './index';

const defaultProps = [
  {
    tripLinkText: 'Book an airport transfer'
  }
 {
    tripLinkText: 'Book an Hotel transfer'
  }
]

describe('trip card section', () => {
  it('testing', () => {
    const wrapper = shallow(<tripDetails {...defaultProps} />);
    expect(toJSON(wrapper)).toMatchSnapshot();
  });
});

But i need to check if some element is present. I dont want snapshot testing,other than that what all i can test? if so how i will write the same

Aucun commentaire:

Enregistrer un commentaire