# Tests Two suites that run the extension's real code under plain Node. Nova's runtime and a Gitea server are both stubbed, so there is nothing to install and nothing to reach over the network. ```sh Tests/run.sh # both suites node Tests/units.test.js node Tests/integration.test.js ``` Both exit non-zero on failure, so `Tests/run.sh` works as a CI step. ## What is here | File | Purpose | | --- | --- | | `nova-stub.js` | Stands in for Nova's runtime: `nova.*`, `TreeView`, `TreeItem`, `Issue`, `IssueCollection`, `Process`, `Range`, `NotificationRequest`. Records messages, clipboard writes, and opened files on globals so assertions can inspect them. | | `fake-gitea.js` | A canned Gitea 1.27 instance served through a `fetch()` stub — three workflow runs, two pull requests, reviews with a line comment, artifacts, secrets, and variables. Records every request it answers. | | `assert.js` | The `Checker` used by both suites. | | `units.test.js` | Remote URL parsing, diff-hunk arithmetic, per-file diff extraction, time formatting, preference precedence, HTTP error messages, the pre-1.24 `/actions/tasks` fallback, pagination and query building, and the no-token path. | | `integration.test.js` | Activates the extension against a real throwaway git checkout, renders all four sidebar sections, and drives the commands that write files or call the API. | `integration.test.js` creates its git fixture in a temporary directory and removes it afterwards; nothing is written inside the repository. ## Adding a case Fixtures live in `fake-gitea.js` — add to the exported data and, if the route is new, to the router at the bottom of that file. Assertions use `t.check(label, condition, detail)` or `t.equals(label, actual, expected)`; `detail` is printed only when the check fails. If a check fails on a value you believe is correct, confirm the expectation by hand before changing the extension — the diff-hunk line arithmetic in particular is easy to get wrong in a test.