Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

  Pros  Pros
- Very easy to set up for unit testing regardless of what other testing tools are used
- Does not require a special environment and configuration
- Good documentation and simple API
- Very fast
- Provides facilities for testing the instance of the component directly:

describe('

...

Tags multiselect', () =

...

{

...

  it('

...

should pass correct data options to the Multiselect component', () =

...

{

...

    const tags = [
      {

...

 id: '1',

...

 label: 'B' },
      {

...

 id: '2',

...

 label: 'A' },
    ];

...




constwrapper=mount(
<Tags
{...baseProps}
tags={tags}
/>
    );

...


constpropsPassedToMultselection=wrapper.find(MultiSelection).props();

expect(propsPassedToMultselection.dataOptions).to.deep.equal([
      {

...

 value:'a',

...

 label:'a' },
      {

...

 value:'b',

...

 label:'b' },
    ]);
  });


});






Cons
- Issues with testing hooks
- Provides facilities for testing the instance of the component directly. This can encourage harmful testing approaches.