Why I often write unit tests before writing javascript

preview_player
Показать описание

My VSCode Extensions:
- theme: material community high contrast
- fonts: Menlo, Monaco, 'Courier New', monospace
- errors: Error Lens
- extra git help: Git Lens
- tailwind css intellisense
- indent rainbow
- material icon theme
- prettier & eslint
- ES7+ React Snippets
Рекомендации по теме
Комментарии
Автор

Can you do more videos on problems you came across in professional development? Tutorials are dime a dozen, but seldom do I see real world problems and how they were solved from the perspective of a professional developer.

Great content!

tgfeekh
Автор

I have not been coding for too long. but I wanna say you are my favorite web dev channel thanks for what you do man ! hope to be able to do what you do someday

WewCode
Автор

As an intern testing makes me more confident in my code so I know I’m not screwing up daily 💀

spiridonov
Автор

I think there is a miss conception of TDD, since it’s premise is to don’t write any code before you write a Test. That’s a dumb statement because you won’t be writing tests for “everything”. Just the pieces of code that could potentially break if something along the way gets changed and affects the original expectation of the algorithm.

TheRcfrias
Автор

I don't think TDD is an approach you can always take, nor that it's an approach you should always take, BUT I find it really helpful to write tests when I'm stuck on a problem, since it helps you understand the problem better and also helps you test your solutions.

When in doubt, write tests 🧑🏻‍💻
Thanks for the great content! 🙏

nitzanpap
Автор

"You can't figure this out in your head. ... I mean you can if you're smart"

Every human: i aM shhmart😏 ezi pizzi lemons squizzi

--Arthur
Автор

Thumbs up for admitting most of us are not geniuses. If you are not a genius, you are not alone. Do tests.

renifer
Автор

Why wouldn’t you sort this on the server and send the sorted response?

gixxerblade
Автор

First time seeing tests on React instead of an actual library 😂

Notoriousjunior
Автор

I built this kinda stuff by myself without any tests, just using .filter() and .some() (my case was sorting users by their roles [superuser, admin, user], but having users, who are administered by another user of a higher role, come first). It took me some hours though. But it was fun.

fonzanedelungini
Автор

If you don't test your code, you are not a good coder. Period.
You are just shifting your responsibility to someone else.

That's why companies have QA division, for the sake of pinning the blame to such division when something f'd up in the production.

TDD is a hassle because the coder is not used to do it. It takes practice, a lot of practice.

If you are in an enterprise setting and the codebase has no unit/integration test at all, you might want to make a big plan for that.
But, in your personal project, the control is all on you. You are in charge of the project from scratch.

My point is there is always a way to incorporate testing into the development process. It's just a matter of commitment towards quality.

Rey_R_
Автор

The main problem with exhaustive testing batteries is that in a couple months, if another dev has to add or change functionality on that function, they will have to understand first the edge cases, the logic underneath the component / function and then read and understand why the test is coded like you - or any other developer who wrote it originally - did it that specific way.
So in your concrete example, the other dev will have to figure out why you choose those names, group numbers and leaders when writging the mock!

It's an overhead that's certainly necessary but it must be taken into account by the managers / scrum leaders / POs / etc

Автор

EDIT: The title of the video originally mentioned Test Driven Development approach to writing code. It has since been changed by the uploader.

This isn't a very good showcase of TDD. TDD approach is meant to influence the design of your system to ensure your implementation can be easily unit tested. Normally, the influence on your design would be in the form of writing smaller, more modular classes. In your example you are only looking at the correctness of your code, not whether your implementation is following good coding standards (it doesn't).

In practice, if you are just interested in the correctness of your code, then going with TDD approach won't offer you much.

Ufnius
Автор

so the value of tests peak the more complex the business requirements get, gotcha

st-jngk
Автор

I don’t see the value in the test. Cant you just visually see that the sorting isn’t correct in the table? Especially since you have to mentally understand the output to write the test anyway. So why waste time?

johnbattista
Автор

Stop lying we'll know nobody writes like this

krtirtho
join shbcf.ru