From b92c860ef53f233e5df700805b0ca74d0bf1ac7c Mon Sep 17 00:00:00 2001 From: LiZhenhai-MBP14 <5935568+jackhai9@users.noreply.github.com> Date: Mon, 21 Sep 2026 18:39:39 +0800 Subject: [PATCH 1/2] docs: clarify behavioral test scope --- docs/test-policy.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/test-policy.md b/docs/test-policy.md index 4a4d8a7..7d3281f 100644 --- a/docs/test-policy.md +++ b/docs/test-policy.md @@ -5,6 +5,13 @@ describe an observable outcome, execute the real behavior being checked, and fai when that outcome changes. A new runner or a large mocking framework is not required for this policy. +These principles also apply to backend services, workers, CLIs, and libraries. +This file defines their userscripts implementation: Node/JSDOM/Playwright tools, +the `user ` title prefix, source coverage scope, critical modules, and browser +validation are repository contracts. Other repositories define equivalent checks +for their own entrypoints and infrastructure. Shared agent guidance alone does +not establish that another repository's existing tests or CI already comply. + Use the Node version pinned by `.nvmrc`. The relevant commands are: | Command | Evidence | @@ -24,6 +31,12 @@ the current live Binance DOM or grant permission for financial actions. ## Behavior Names and Stages +Before changing production behavior, write or identify its Given/When/Then +acceptance scenario with executable setup, an action, and an observable expected +result. For a regression, first add or identify a test that fails for the observed +problem, then make the same scenario pass. Review checks the business meaning; +lint checks the stage structure and cannot prove test-first development order. + All Node test files and `e2e/**/specs/**/*.pw.js` scenarios use a title beginning with `user `. Describe the observable behavior in the rest of the title. A parameterized title such as `` `user sees ${quantity} accepted orders` `` keeps a From 0cbf703d4c8610bf23ad477cbd082ea53b07fc21 Mon Sep 17 00:00:00 2001 From: LiZhenhai-MBP14 <5935568+jackhai9@users.noreply.github.com> Date: Mon, 21 Sep 2026 18:54:45 +0800 Subject: [PATCH 2/2] test: stabilize Brooks import ordering --- test/unit/brooks-media-import-index.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/unit/brooks-media-import-index.test.js b/test/unit/brooks-media-import-index.test.js index 6ae68fb..e4c11af 100644 --- a/test/unit/brooks-media-import-index.test.js +++ b/test/unit/brooks-media-import-index.test.js @@ -1,6 +1,6 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { mkdir, mkdtemp, readFile, rm, utimes, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; import { tmpdir } from 'node:os'; import { @@ -62,6 +62,9 @@ test('user observes that Brooks media index import moves the latest completed ex const latestPath = join(downloadsDir, 'brooks-media-index-2026-06-03 (1).json'); await writeFile(oldPath, JSON.stringify(createIndex('2026-06-03T09:00:00.000Z'), null, 2)); await writeFile(latestPath, JSON.stringify(createIndex('2026-06-03T10:42:15.123Z'), null, 2)); + // Filesystems can coalesce sequential write mtimes, so model the browser download order explicitly. + await utimes(oldPath, new Date('2026-06-03T09:00:00.000Z'), new Date('2026-06-03T09:00:00.000Z')); + await utimes(latestPath, new Date('2026-06-03T10:42:15.123Z'), new Date('2026-06-03T10:42:15.123Z')); // When the importer resolves the appropriate report destination const result = await importLatestBrooksMediaIndex({ downloadsDir, reportsDir });