DEV Community

Discussion on: TypeScript vs JavaScript🤔

 
joelbonetr profile image
JoelBonetR 🥇

@natescode tests do not validate implementation details, tests validare behaviour, which is just what you want to avoid changing when refactoring.

By the ctrl+f thingy seems that the testing concept is not so clear and you still thing that refactor is just "changing code".

If you added a third parameter to a function chances are that the best option really was to split it instead or if you run against the clock simply set it as optional instead and mark it to refactor in the future 🤷🏻‍♀️

The reason for tests is not to add "correctness" bit to add confidence in the code which is something that types alone can't provide.