Agent Wranglers

Build, test and deploy Recommended

Unit test the tricky parts

Test logic that can break silently on its own, without a network, a database or a browser.

How to do it

Keep small, fast tests next to the code for anything with branches or calculations, such as parsing, prices and dates. Run them before every build. For more depth, see the testing playbook.

Example

// date.test.js, run with: node --test
import test from 'node:test';
import assert from 'node:assert/strict';
import { formatDate } from './date.js';

test('formats a date for people', () => {
  assert.equal(formatDate('2026-10-20'), '20 October 2026');
});

How to check

The tests run in seconds, in the full check before every deploy. Break the logic on purpose, and a test fails.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/build-test-and-deploy/unit-tests-for-the-tricky-parts.