Files
gitea-nova/Tests/README.md
T
thatguygriffandClaude Opus 5 694609a3cc Implement the Gitea extension
The repository was a bare Nova scaffold. This builds it out to match the
capabilities of the official Gitea VS Code extension.

Sidebar sections:
  - Current Branch: pull requests and workflow runs for the checked-out
    branch, with a current/all/pinned branch filter
  - Workflows: runs grouped by workflow file, expanding into jobs, steps,
    and artifacts
  - Pull Requests: open pull requests across repositories, expanding into
    reviews, review comments, and changed files
  - Settings: per-instance connection state, plus repository Actions
    secrets and variables

Commands cover run control (re-run, re-run failed jobs, re-run a job,
cancel), job logs, artifact download/reveal/open, pull request overview,
diff, checkout, creation, merge and close, the full review cycle, and
secret and variable management. Multiple instances are supported, routed
by git remote host, with tokens held per instance in the Keychain.

Nova exposes no webview, diff editor, editor decorations, or extension
status bar, so four features are shaped differently from the VS Code
original: the pull request timeline renders as Markdown, diffs open as
unified .diff documents, review comments are published through an
IssueCollection so they appear in the gutter and the Issues sidebar, and
a failed run posts a notification. OAuth and insecureSkipVerify have no
Nova equivalent and are omitted. README.md records all of this.

Endpoints were taken from Gitea's published swagger.v1.json. Servers
predating the workflow runs API fall back to /actions/tasks.

Tests/ runs the extension's real code under Node against a stubbed Nova
runtime and a canned Gitea instance: 88 checks, no install step and no
network. Images are generated by Tools/make-icons.py.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MQuusXgZC2dzwpJJ1qhtti
2026-08-28 19:55:54 -03:00

2.0 KiB

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.

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.