Component test utils

Component test utils

  • Philosophy
  • Doc
  • Blog

›Introduction

Introduction

  • Documentation
  • Getting Started

Shallow

  • shallow/constructor
  • shallow/html
  • shallow/props
  • shallow/setProps
  • shallow/querySelector
  • shallow/querySelectors
  • shallow/exists
  • shallow/dispatchEvent
  • shallow/unmount

Frameworks

  • api-react
  • api-vuejs
  • api-angular
  • api-vanilla

Getting Started

As each framework are different, the installation is different for each framework. After that, the API will be the same, promise !

React

Installation

Start by installing dependencies with npm:

npm i -D component-test-utils-react

or with yarn:

yarn add -D component-test-utils-react

Hello test world with jest

You can test everything work well by executing this test (with jest):

import {shallow} from 'component-test-utils-react';

test('component-test-utils-react should work', () => {
  const Hello = () => <div>Hello</div>;
  const cmp = shallow(<Hello />);

  expect(cmp.html()).toBe('<div>Hello</div>');
});
← Documentationshallow/constructor →
  • React
    • Installation
    • Hello test world with jest
Component test utils
Docs
Getting StartedAPI Reference
More
BlogGitHubStar
MIT Copyright © 2020 Florent Berthelot