|
|
|
|
|
by Scarblac
1060 days ago
|
|
> if you're working with people who randomly 'forget' things while they are doing development, then I guarantee that you're working with people who also write buggy code. In fact, in this case, it was ME who wrote that buggy code. I own it. We all write bugs, we're human and it's hard to think of everything all of the time. My point was, when we make a thinking error that causes us to write a bug, that same thinking error means we also don't write that test that could find it. If you had thought of writing a test for the disabled thing when you wrote the code, you also would have written it correctly because you would have had that case in mind then. Now you have a test, but because someone reported the bug and you fixed it. Now it's almost certainly not useful to have anymore. I believe in automated tests, but for tricky logic mostly. |
|
Humans can't think of everything all the time - TDD guides you to think about one thing at a time.
No one is sitting there adding a disabled prop on their component that then disables an input for no reason. You had intent when writing it. It's possible that a co-worker distracted you, or you went for a break, or you went down another rabbit hole, and ended up skipping disabling the input based on the prop.
If you're practicing TDD, you would have written a failing test before creating the disabled prop. That test will continue to fail until the productive code has been written. It helps to protect against those thinking errors in the first place.