From d493291025432f01cb69036deea9c63bc0779449 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Thu, 1 Jan 2026 16:51:02 +0100 Subject: [PATCH] update the readme --- test/backend-test/README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/backend-test/README.md b/test/backend-test/README.md index 775ffb7a8..8822562ab 100644 --- a/test/backend-test/README.md +++ b/test/backend-test/README.md @@ -4,14 +4,26 @@ Documentation: https://nodejs.org/api/test.html Create a test file in this directory with the name `*.js`. +> [!TIP] +> Writing great tests is hard. +> +> You can make our live much simpler by following this guidance: +> - Use `describe()` to group related tests +> - Use `test()` for individual test cases +> - One test per scenario +> - Use descriptive test names: `function() [behavior] [condition]` +> - Don't prefix with "Test" or "Should" + ## Template ```js -const test = require("node:test"); +const { describe, test } = require("node:test"); const assert = require("node:assert"); -test("Test name", async (t) => { - assert.strictEqual(1, 1); +describe("Feature Name", () => { + test("function() returns expected value when condition is met", () => { + assert.strictEqual(1, 1); + }); }); ```