testing

A set of Vitest unit-testing rules for checking the application's deterministic core and selected data-processing code. Unit tests check one behavior at a time using Arrange, Act, and Assert sections.

In plain words
What is it for?
Use it to organize tests, name observable behaviors, and cover the required event, venue, date, feasibility, pricing, hotel, and payload cases.
Why use it?
It makes failures easier to locate and protects calculations and data normalization from regressions.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/evilfreelancer/zaezd/testing
Clone the repo
git clone --depth 1 https://github.com/EvilFreelancer/zaezd

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,068 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01068
Opus 5 $0.00000 $0.00534
Sonnet 5 $0.00000 $0.00214
Haiku 4.5 $0.00000 $0.00107

Measured yesterday against content hash daddf1d29f29, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/testing.mdc · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Unit tests

Vitest, tests/**/*.test.ts. Unit tests protect the deterministic core; the observable behavior of the product is protected by the Gherkin specs in features/ (see @bdd-specs.mdc). Write the spec first, the unit test second, the code third.

Layout and naming

  • File: tests/<module>.test.ts, mirroring the module under test.
  • describe('<module or function>'), it('<observable behavior>'). The sentence in it reads as a fact: it('pulls check-in one day earlier for a morning event').
  • Arrange / Act / Assert, in that order, with a blank line between the blocks.
  • One behavior per test. A test that asserts four unrelated things hides which one broke.

What is unit tested

The pure layer, exhaustively. Everything in src/composer/ that has no I/O, plus payload normalization in src/sources/ and the cache key builder.

The mandatory set, from specs/08-repozitoriy.md; each one is a real defect that has been observed or is one payload away:

  1. An online event builds no trip.
  2. An empty or unrecognized venue yields no precise marker.
  3. Check-in is one day before start_date for a morning event.
  4. An event finishing late adds one more night.
  5. Arrival after starts_at minus 60 minutes is flagged and cannot be the primary package.
  6. The hotel price is not multiplied by the number of nights (price_basis: "stay_total").
  7. The total price includes both the outbound and the return leg.
  8. A hotel geo_id is never taken from a transport response.
  9. A hotel checkout built without offerpack_hash is not labelled a cart.
  10. Equivalent argument shapes produce one cache key.
  11. A partial transport-mode failure is not turned into "there is no such transport".
  12. A free-text event price stays out of the sum.

Twelve more that the plan review surfaced, each a defect one payload away:

  1. An ISO time with an offset is compared on the right calendar day: 11:59+03:00 must not cross noon or slide to the neighbouring date on the way through UTC.
  2. Zero nights is a legal answer and produces a hotel-less package, not a forced night.
  3. Every tie in the three package rules is broken by a stable secondary key.
  4. Working days burnt differ between a night departure and a midday one, so "Без отпуска" does not collapse into "Дешевле всего".
  5. "от 7 000 ₽" parses as a lower bound and the total is labelled as one.
  6. The cache does not store a rejected promise, coalesces identical in-flight requests and respects its size ceiling.
  7. trip_id round-trips Cyrillic, sorts its keys canonically, and rejects a corrupted string, an unknown version and one over the length ceiling.
  8. Every string from a source is escaped in text, in attributes, in URLs and inside the embedded JSON.
  9. A walking time is never derived from an OSRM car-profile answer.
  10. A total assembled without a hotel is not called the full participation price.
  11. Empty sets: no return leg, no hotel, no feasible pair at all.
  12. In replay the reference date is the fixture's recorded_at, not the wall clock.

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 94 lines · 0 tokens per session scan A daddf1d29f29

Subscribe to this mod's changes

testing is a cursor rule published in the GitHub repository EvilFreelancer/zaezd (1 stars, last pushed 13d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,068 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.