Skip to content

fix: #363 #364

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

Merged
merged 1 commit into from
Jun 9, 2021
Merged

fix: #363 #364

merged 1 commit into from
Jun 9, 2021

Conversation

hazem3500
Copy link
Contributor

closes #363

Copy link
Contributor

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM! Test would be nice 😉

@hazem3500
Copy link
Contributor Author

I've tried writing a test but the test code was a bit difficult for me to "parse"(pun semi-intended 😅).
So it would be great if someone pointed me on how to write a test for this PR.
We would want to write a test for it should parse component without parameters in function statement or it shouldn't throw an error if the component doesn't have parameters in function statement, right?

@pvasek
Copy link
Collaborator

pvasek commented Jun 7, 2021

@hazem3500 I think the easiest way is to pick one of the existing test component from src/__tests__/data. The most simple one and closest to your case. If you find one, great, you can copy it name it as you want and you can also copy the original test and update it.

If there is no such component, don't worry, just create the most simple example you want to cover in src/__test__/data and create a test for it. The test can be harder to read because they use helpers for checking the expected results but once you try to put it together I am sure you will understand.

From what you suggest, the it should parse component without parameters in function statement seems better to me but that's just personal taste.

@hazem3500
Copy link
Contributor Author

I've tried writing a test again, but I couldn't find a case where functionStatment.parameters is undefined

I thought maybe it's the typescript version, mine was 4.2.2 but after upgrading most of the test threw other errors 😅

@pvasek
Copy link
Collaborator

pvasek commented Jun 9, 2021

@hazem3500 ok, as the change is so small and obviously more robust. I am merging it without new tests.

@pvasek pvasek merged commit 6c2a088 into styleguidist:master Jun 9, 2021
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.

Cannot read property 'length' of undefined
3 participants