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

test(factories): add factory tests #552

Merged
merged 3 commits into from
Oct 5, 2016
Merged

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Sep 27, 2016

This PR adds tests for createShorthand, it does not add tests for every shorthand factory, however, they are partially applied so it is almost redundant.

@levithomason levithomason force-pushed the feature/factory-tests branch from 267dc85 to d2180ca Compare October 4, 2016 01:58
@codecov-io
Copy link

codecov-io commented Oct 4, 2016

Current coverage is 100% (diff: 100%)

No coverage report found for master at 661cf35.

Powered by Codecov. Last update 661cf35...3e0d6c6

@@ -16,7 +16,7 @@ const mergePropsAndClassName = (defaultProps, props) => {
newProps.className = cx(defaultProps.className, props.className) // eslint-disable-line react/prop-types
}

if (!newProps.key) {
if (!newProps.key && childKey) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Prevent adding childKey: undefined due to props with no key and also not defining a childKey. This issue was revealed by tests.

@levithomason levithomason force-pushed the feature/factory-tests branch from 4b60626 to 908ec25 Compare October 4, 2016 23:13
@levithomason
Copy link
Member Author

Just force pushed from an array tests

itReturnsNullGivenDefaultPropsFunc(null)
})

describe('from undefined', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Add similar tests for booleans. Both true and false should return null

})
}

const itMergesClassNames = (extraClassName, classNameSource, shorthandConfig) => {
Copy link
Member

Choose a reason for hiding this comment

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

Put classNameSource as first arg:

  • matches propsSource being first in the functions below
  • currently args 1 and 3 are used in the test and 2 is used to describe the test which is a little confusing.

Copy link
Member

@jeffcarbs jeffcarbs left a comment

Choose a reason for hiding this comment

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

Left a few suggestions but looks good otherwise so I'm approving 👍

@levithomason levithomason force-pushed the feature/factory-tests branch from 908ec25 to 3e0d6c6 Compare October 5, 2016 15:19
@levithomason
Copy link
Member Author

Thanks much, updated both suggestions. Will merge on pass.

@levithomason levithomason merged commit ddb6349 into master Oct 5, 2016
@levithomason levithomason deleted the feature/factory-tests branch October 5, 2016 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants