write-tests-frontend

write-tests-frontend is a cursor rule for Cursor from golid-ai/golid. It costs 0 tokens per session (1,088 once invoked), scanned A, original, MIT.

A set of rules for testing SolidJS interface components with SolidJS Testing Library. The tests check visible behavior, inputs, callbacks, and failure cases, including permission errors, invalid states, missing records, and duplicates.

In plain words
What is it for?
Use it when adding or updating frontend component tests. It helps test what users can see and do, verify event handling and properties, and cover common service and error responses.
Why use it?
It catches problems that a successful manual test may miss, especially when an operation should be rejected. It also accounts for jsdom, the browser-like test environment, which does not reproduce every real browser behavior.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or updating frontend component tests. It helps test what users can see and do, verify event handling and properties, and cover common service and error responses.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/golid-ai/golid/write-tests-frontend
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.

Clone the repo
git clone --depth 1 https://github.com/golid-ai/golid

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for write-tests-frontend

README.md
[![agentmods](https://agentmods.dev/badge/rules/golid-ai/golid/write-tests-frontend/github.svg)](https://agentmods.dev/rules/golid-ai/golid/write-tests-frontend)
Your own site
<a href="https://agentmods.dev/rules/golid-ai/golid/write-tests-frontend"><img src="https://agentmods.dev/badge/rules/golid-ai/golid/write-tests-frontend/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for write-tests-frontend

Your own site · 80×15
<a href="https://agentmods.dev/rules/golid-ai/golid/write-tests-frontend"><img src="https://agentmods.dev/badge/rules/golid-ai/golid/write-tests-frontend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,088 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01088
Opus 5.5 $0.00000 $0.00435
Sonnet 5.5 $0.00000 $0.00218
Haiku 4.5 $0.00000 $0.00109

Measured 3mo ago against content hash b9485b7b157d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

write-tests-frontend 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 3mo ago.

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/write-tests-frontend.mdc · 117 lines

How it starts

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

Writing Frontend Component Tests

Thesis: Frontend tests verify behavior through props, callbacks, and rendered content — not rendering existence alone. Know jsdom's limits.

Before writing tests for a module, read docs/modules/{module}/spec.md for the Critical Test Scenarios section — it's a verified test plan.

Always Test Error Paths

Don't just test happy paths. Every service method should have tests for:

  • Permission denied — wrong user type, non-owner, non-member → expect FORBIDDEN
  • Invalid status — operation on wrong-status entity → expect BAD_REQUEST
  • Not found — non-existent ID → expect NOT_FOUND
  • Duplicate/conflict — re-creating existing entity → expect CONFLICT

These are the bugs that slip through manual testing and break in production.

This section is intentionally duplicated in write-tests.mdc and write-tests-frontend.mdc. If updated, change both.

Component Unit Tests (SolidJS)

Use @solidjs/testing-library for component-level tests. Test the public API: renders, accepts props, fires events.

import { afterEach } from "vitest";
import { cleanup, render, screen, fireEvent } from "@solidjs/testing-library";
import { Button } from "./Button";

afterEach(cleanup);

test("calls onClick", async () => {
  const handler = vi.fn();
  render(() => <Button onClick={handler}>Click</Button>);
  await fireEvent.click(screen.getByText("Click"));
  expect(handler).toHaveBeenCalledTimes(1);
});

Place test files next to the component: Button.test.tsx alongside Button.tsx. Vitest discovers src/**/*.test.{ts,tsx} automatically.

Important: vitest.config.ts must have resolve.conditions: ["development", "browser"] to prevent Solid from resolving server-side bundles in jsdom.

Always call afterEach(cleanup) in *.test.tsx files that use @solidjs/testing-library. Without cleanup, previous renders can leak Solid computations into the next test and emit "computations created outside a root" warnings.

Read the full file on GitHub · 117 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. 3mo ago First seen · 117 lines · 0 tokens per session scan A b9485b7b157d

Subscribe to this mod's changes

write-tests-frontend is a cursor rule published in the GitHub repository golid-ai/golid (41 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,088 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-30.

Related

write-tests-frontend compared with cursor rules from other repositories

write-tests-frontend next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
write-tests-frontendgolid-ai/golidCursor rule415mo agoMITA0Cursor
unit-tests-tddarxdsilva/vaultCursor rule31mo agoMITA427Cursor
go-testing-practicesdstotijn/go-mcpCursor rule181y agoApache-2.0A0Cursor
python-general-coding-standardsholtwood/awesome-cursorrules-zhCursor rule2441mo agoMITA140Cursor
unit-testing-standardsadobecom/da-express-miloCursor rule66d agoApache-2.0A2,431Cursor
testing4thfever/cultivation-world-simulatorCursor rule2.2k3mo agononeA0Cursor
threaded-test-timeoutbriangmilnes/APAS-VERUSCursor rule102mo agoMITA123Cursor