Why I write the test first, sometimes
Test first when I know what the answer should be. Code first when I am still finding out what the question is.
I write the test first when I know what the answer should be: a parser, a price calculation, a bug someone reported with an example. I write the code first when I am still finding out what the question is, and add the test once I know.
That rule has held for three years. It fails in one place: code I am sure I understand. Those are the functions that come back with a bug report a month later.
test('a key without = has an empty value', () => {
assert.equal(parse('a&b=1').get('a'), '');
});
subscribe
New entries and the next chapter by mail, nothing else.