ducdoanh.info — Visual Studio Code
tdd-comment-format.md
UTF-8 · LF

TDD comment format

A four-line scaffold I use inside every test block.

I put a small comment scaffold at the top of every test body:

it("does the thing", () => {
  // arrange
  // confirm
  // act
  // assert
});
  • arrange — set up inputs and dependencies.
  • confirm — assert the pre-condition is what I think it is.
  • act — invoke the unit under test.
  • assert — verify the new state.

The confirm step is what most "AAA" templates miss — it catches a huge class of false-positive tests where the arrange step silently did the wrong thing.