Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Don't unit test component methods directly #703

Closed
reyraa opened this issue Sep 5, 2017 · 0 comments
Closed

Don't unit test component methods directly #703

reyraa opened this issue Sep 5, 2017 · 0 comments

Comments

@reyraa
Copy link
Contributor

reyraa commented Sep 5, 2017

Expected behaviour

We' moved all the no presentational logics out of our components and just left them with presentational behaviours.
So, preferred is to look at the component as a black box that we won’t penetrate to test. we’ll check its behaviour from outside. so this makes it a unit test in which unit resembles a component as a whole.
an example of such a test is:

it('should allow to change passphrase field to type="text"', () => {
      expect(wrapper.find('.passphrase input').props().type).to.equal('password');
      wrapper.setState({ showPassphrase: true });
      expect(wrapper.find('.passphrase input').props().type).to.equal('text');
});

Actual behaviour

in some cases we test componentDidMount or other specific method directly using notations like:
wrapper.instance().validateUrl

Steps to reproduce

This, this and this are some samples of this kind of tests.

@slaweet slaweet added this to Issues in Sprint Board 30-10-17 Oct 26, 2017
@slaweet slaweet added this to Issues in Version 1.3.0 via automation Nov 2, 2017
@slaweet slaweet removed this from Issues in Sprint Board 30-10-17 Nov 6, 2017
@slaweet slaweet added this to Issues in Sprint Board 06-11-17 via automation Nov 6, 2017
@slaweet slaweet closed this as completed in 025c683 Nov 8, 2017
Version 1.3.0 automation moved this from Issues to Closed Issues Nov 8, 2017
Sprint Board 06-11-17 automation moved this from Issues to Closed Issues Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Sprint Board 06-11-17
  
Closed Issues
Version 1.3.0
  
Closed Issues
Development

No branches or pull requests

2 participants