Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/test-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion test/unit/brooks-media-import-index.test.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 });
Expand Down
Loading