Logo vun Hor Backend Testing

Hor Backend Testing

Organisatioun
openreachtech
hor-backend-testing

Organize and run the backend repository's tests: where a test file goes (tests/__tests__ for tests that do not write to the database, tests/_orders for tests that do), how run order among DB-writing tests is guaranteed, how to run the whole suite or a single test, and the purity rules for tests and their doubles. Use whenever the user asks where to place a test, how to guarantee test order, how to run tests, or how to keep tests pure. Manual E2E verification is out of scope.

Iwwersiicht

Editeuropenreachtech
Repositoryhora-skills-ort-renchan
Skill-Nummhor-backend-testing
Stären
32
Forks
0
Matgeliwwert Fichieren
3
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum openreachtech op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Hor Backend Testing an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-backend-testing
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openreachtech/hora-skills-ort-renchan.git /tmp/hora-skills-ort-renchan
mkdir -p .claude/skills
cp -r /tmp/hora-skills-ort-renchan/kit/skills/hor-backend-testing .claude/skills/hor-backend-testing
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Hor Backend Testing an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Hor Backend Testing automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Hor Backend Testing net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Backend Testing

A skill for implementing tests in a backend repository: where each test file belongs, how DB-writing tests are ordered so they do not corrupt each other, how to run them, and the purity rules that keep a failing test meaningful. It governs test organization and discipline — the writing style of an individual test (describe/test structure, case data, naming) follows the project's own Jest conventions and is out of scope here.

This skill states a general, project-independent rule, not one repo's current tree. The directory names (tests/__tests__, tests/_orders, tests/mocks, tests/tools) are the recommended layout — map them onto your project. Sample code follows the project's lint style (no semicolons, 2-space indent, trailing commas).

Core principle: a test fails only when the code under test is wrong

A test must fail only because the code it exercises is wrong — not because another test ran first, and not because the test itself contains untested logic. Two rules enforce that, and everything below follows from them:

  1. Isolate database state. A test that writes to the DB mutates shared seed data that other tests read, so it is placed apart from tests that don't, and ordered among its peers.
  2. Keep tests pure. A test may only exercise code that is itself already tested — no logic is invented inside a test, and every mock/tool it leans on has its own test cases.

1. Placement & execution order

Split every test by one question: does it write to the database?

LocationContentsOrdering
tests/__tests__/tests that do not write to the DB (pure units, read-only)order-independent — run in any order
tests/_orders/<Category>/tests that do write to the DBorder-guaranteed within a category via a _.test.js barrel
  • Why the split. A DB-writing test changes the shared development / dev-master seed fixtures, so a later test can observe a mutated database. Read-only tests can't interfere, so they need no ordering; DB-writing tests must be ordered.
  • The order barrel. Each category folder holds _.test.js that imports its test files in the order they must run — that import order is the execution order within the category.
  • Cross-category order is NOT guaranteed. _orders fixes order within a category only. If two categories can interfere, isolate them into separate CI jobs — add/update a .github/workflows/*.yml per category so each runs against its own fresh database.
  • Verification against real middleware belongs in neither location. Exercising the product against a real broker, search cluster and change-data-capture pipeline needs those services brought up in Docker and is done by hand, outside tests/ entirely — see the E2E environment convention. No such file is added here, and npm run test stays runnable with nothing but Node installed.

Details, the barrel example, and the per-category workflow snippet are in placement-and-ordering.md.

2. Running tests

  • Whole suite: npm run test — rebuilds the DB (teardown → migrate → seed) and runs everything on SQLite (the local default). Authoritative, slowest.
  • A single test (fast, no rebuild): iterate by invoking Jest directly against one file — NODE_OPTIONS="--experimental-vm-modules" NODE_ENV=development npx jest <path> (add --runInBand for DB-writing/order-sensitive tests). It runs against the DB as it currently is, so prepare the DB once and reset it piecemeal (migrations-only / one-seeder-set) instead of a full rebuild.
  • Live (real-dialect) run: running against the database the project's specification names (MariaDB, MySQL or PostgreSQL) instead of SQLite requires that database running locally, selected with NODE_ENV=live. Test against the one the specification names, never another database of the same family. How that database is stood up is not part of this convention.
  • Parallelism × per-worker heap must fit in real memory. Jest runs one worker per core by default, and --max-old-space-size is not a reservation — it is how far the GC may be deferred, so a value the machine cannot actually give lets every worker grow until it crashes the machine (one worker alone can do it). Derive the cap from a measured peak, check that workers × cap fits in the memory actually free, and re-check as the project grows: per-worker usage rises with every model and seeder added, so a pair that fit at the start can later crash the machine.

The exact commands, the suite runner's steps, the fast single-test loop with the piecemeal DB reset, and how to size the worker/heap budget are in running-tests.md.

3. Test purity & test doubles

  • No new logic in a test. Never define a function or class inside a test to compute an expected value or stand in for production behavior — an untested helper can be wrong, making the test lie. Assert against literal expectations.
  • Everything a test uses must already be tested. Every function, class, mock, and tool the test leans on has its own test cases.
  • Doubles live under tests/, and are themselves tested. Mocks go in tests/mocks/, shared test tools/factories in tests/tools/, and each mock class has its own test file. Prefer explicit fakes (obviously-fake names/values).

The rule with good/avoid examples, and the mocks/tools layout, are in purity-and-mocks.md.

Finishing checklist

  • The test is in tests/__tests__/ if it does no DB write, or tests/_orders/<Category>/ if it does (§1).
  • A DB-writing test is imported (in the right position) by its category's _.test.js barrel.
  • If the new test's category can interfere with another, a per-category CI workflow isolates them.
  • The test defines no new logic; every function/class/mock it uses is already tested (§3).
  • Any new mock/tool lives under tests/mocks/ or tests/tools/ and has its own test file.
  • Verified with a single-test run (§2).

Detail files

  • placement-and-ordering.md — __tests__ vs _orders, why DB-writing tests need ordering, the _.test.js order barrel, cross-category isolation via per-category CI workflows (§1)
  • running-tests.md — the whole-suite runner and what it does, running a single test with the dev/master seed sets, resetting the database piecemeal, sizing the parallelism × heap budget against real memory, and what a live (real-dialect) run requires (§2)
  • purity-and-mocks.md — no-new-logic and only-tested-code rules with good/avoid examples, and the tests/mocks / tests/tools layout where doubles are themselves tested (§3)

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Hor Backend Testing?

Organize and run the backend repository's tests: where a test file goes (tests/__tests__ for tests that do not write to the database, tests/_orders for tests that do), how run order among DB-writing tests is guaranteed, how to run the whole suite or a single test, and the purity rules for tests and their doubles. Use whenever the user asks where to place a test, how to guarantee test order, how to run tests, or how to keep tests pure. Manual E2E verification is out of scope.

Firwat Hor Backend Testing op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Hor Backend Testing besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Hor Backend Testing an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-backend-testing an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Hor Backend Testing benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Hor Backend Testing benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Hor Backend Testing domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Hor Backend Testing gratis?

Jo. De Skill gëtt vum openreachtech ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇