Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Spinner component tests. #936

Closed
wants to merge 1 commit into from

Conversation

BE-Webdesign
Copy link
Contributor

Adds basic Spinner component tests. Related to progress on #641.
Testing Instructions
Run npm i && npm run test-unit ensure tests pass. Change component logic
to ensure tests fail as they should.

@BE-Webdesign BE-Webdesign added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label May 30, 2017
it( 'should match the following element', () => {
const element = <span className="spinner is-active" />;
const spinner = shallow( <Spinner /> );
expect( spinner.matchesElement( element ) ).to.be.true();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we put the limit between testing the markup or not?

I think you're doing an awesome job testing all these components, but do we really need to add this test specifically? Does it avoid any regression, what's the value here since we're basically copy/pasting the content of the component here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found tests like this useful when I change markup in a component and forget to update the styles. When things fail it reminds me to update the style. I can understand them not being useful persee, but I typically aim for 100% coverage. On projects that move relatively fast like this, I think more tests over fewer tests is better. It should probably be decided what we are going to test, how, and why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened up #939 for discussion! Add your thoughts there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These kind of tests are also useful for when you need to do upgrades, so you can know a lot of what is broken from the unit tests themselves.

Adds basic Spinner component tests. Related to progress on #641.
Testing Instructions
Run npm i && npm run test-unit ensure tests pass. Change component logic
to ensure tests fail as they should.
@BE-Webdesign BE-Webdesign force-pushed the add/test/components/spinner branch from cdf0b29 to effef54 Compare May 30, 2017 16:08
@BE-Webdesign
Copy link
Contributor Author

Any oppositions to merge?

@aduth
Copy link
Member

aduth commented Jun 1, 2017

Do you find #939 to have settled previous concerns? It's a strange case, since the component really has no variation and the logic is minimal. Seems most we care to do is expect it returns something, which I suppose the tests here are doing. To the granularity that we care to test markup, I don't really know where we draw the line. I think most value would come from if we expect different props (inputs) to affect output, which we don't have here.

I'm mostly indifferent. Personally I'd be fine if this component had no tests at all in its current form, but I don't think there's much harm in including them, aside from precedent in how to handle such scenarios in the future if we worry that it introduces more overhead than it provides benefit.

@BE-Webdesign
Copy link
Contributor Author

Closing as it doesn't provide much benefit at this time. Nor will it most likely in the future.

@ntwb ntwb deleted the add/test/components/spinner branch August 5, 2017 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants