aamay001 / react-resume

Resume Builder in React
https://resumejs.netlify.app/
107 stars 52 forks source link

Component Tests #36

Closed aamay001 closed 4 years ago

aamay001 commented 5 years ago

Write tests.

JaiParakh commented 5 years ago

Can you please explain the issue in detail.

aamay001 commented 5 years ago

Can you please explain the issue in detail.

You can add any test that you'd like to add for Components (i.e. rendering tests, etc.) Use Jest.

paulywill commented 5 years ago

@aamay001 I’m going to take this on.

paulywill commented 5 years ago

@aamay001 How does one run the: VisibilityChanger.test.js ?

Still learning learning the difference between tests.

aamay001 commented 5 years ago

@aamay001 ~How does one run the: VisibilityChanger.test.js ?~

Still learning learning the difference between tests.

just for reference, it's npm run test

paulywill commented 5 years ago

@aamay001 @oriane212 @tsargent

Working away on CodeEditor test and having the troubles with determining if the text 'Code Editor' is between the DIV tags. image

I've put two links on my commit I'll have to read some more later.

Any ideas what I'm doing wrong?

aamay001 commented 5 years ago

You're going one child too deep. It should just be:

expect(menu.firstChild.textContent).toBe('Code Editor');

@paulywill

paulywill commented 5 years ago

@aamay001 Another similar question.

aamay001 commented 4 years ago

Hi Paul,

If you're up for it, that's okay with me. Personally, I have not used snapshots, although, I have read about them. If you see a need to using them, go ahead and submit a PR that includes them and I'll make sure to review.

Thanks,

Andy

On Fri, Jan 24, 2020 at 1:07 PM Paul Gamble notifications@github.com wrote:

@aamay001 https://github.com/aamay001 Is there any interest in us creating snapshots?

I'm just learning that it's tricky if not shallow https://www.robinwieruch.de/jest-snapshot-shallow-render?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aamay001/react-resume/issues/36?email_source=notifications&email_token=AG3UMHIKL6LR5SS4RKTF5WLQ7NJ7JA5CNFSM4ICPIE22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ4DDGY#issuecomment-578302363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3UMHK3LZIMZ6DCJUVFUPDQ7NJ7JANCNFSM4ICPIE2Q .

paulywill commented 4 years ago

@aamay001 Resolved the snapshot for the CodeEditor.

Having a gotcha with testing componentDidUpdate to get full code coverage.

Every example I've looked at suggested shallow mounting using Enzyme.

The react-ace is also adding some complexity, trying to refer some tests from that project.

aamay001 commented 4 years ago

New Issues being added for testing with Crypress.