Toolverse
All skills

testing-patterns

by davila7

Jest testing patterns, factory functions, mocking strategies, and TDD workflow. Use when writing unit tests, creating test factories, or following TDD red-green-refactor cycle.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Author
davila7
Category
Testing
Views
16

About this skill

Jest testing patterns, factory functions, mocking strategies, and TDD workflow. Use when writing unit tests, creating test factories, or following TDD red-green-refactor cycle.

How to use

  1. Zainstaluj skill w swoim projekcie Claude, dodając go do konfiguracji agenta lub importując bezpośrednio z repozytorium davila7.

  2. Zapoznaj się z filozofią TDD: zawsze zacznij od napisania testu, który nie przechodzi, następnie zaimplementuj minimalny kod, aby test przeszedł, a na koniec refaktoruj. Nigdy nie pisz kodu produkcyjnego bez wcześniej napisanego testu, który go wymaga.

  3. Twórz fabryki danych dla swoich komponentów i modeli. Użyj funkcji getMockX z domyślnymi wartościami, które pozwalają na nadpisanie konkretnych właściwości. Na przykład getMockMyComponentProps({ title: 'Custom Title' }) zamiast ręcznego tworzenia obiektu za każdym razem.

  4. Implementuj niestandardowe funkcje render, które opakowują komponenty wymaganymi providerami (np. ThemeProvider). Użyj renderWithTheme zamiast zwykłego render, aby uniknąć powtarzania kodu w każdym teście.

  5. Testuj zachowanie, a nie szczegóły implementacji. Skupiaj się na publicznych API i wymaganiach biznesowych. Pisz opisowe nazwy testów, które wyjaśniają, co powinno się stać, np. 'should render component with custom title' zamiast 'renders'.

  6. Stosuj mocking strategicznie dla zależności zewnętrznych (API, funkcje callback). Skill zawiera przykłady użycia jest.fn() do tworzenia mock funkcji, które możesz asertować w testach.

Related skills

code-reviewer

by google-gemini

Use this skill to review code. It supports both local changes (staged or working tree) and remote Pull Requests (by ID or URL). It focuses on correctness, maintainability, and adherence to project standards.

Testing
1248

code-review-excellence

by wshobson

Master effective code review practices to provide constructive feedback, catch bugs early, and foster knowledge sharing while maintaining team morale. Use when reviewing pull requests, establishing review standards, or mentoring developers.

Testing
1145

ad-creative

by alirezarezvani

When the user needs to generate, iterate, or scale ad creative for paid advertising. Use when they say 'write ad copy,' 'generate headlines,' 'create ad variations,' 'bulk creative,' 'iterate on ads,' 'ad copy validation,' 'RSA headlines,' 'Meta ad copy,' 'LinkedIn ad,' or

Testing
2863

playwright-cli

by microsoft

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

Testing
45103

pair-trade-screener

by tradermonty

Statistical arbitrage tool for identifying and analyzing pair trading opportunities. Detects cointegrated stock pairs within sectors, analyzes spread behavior, calculates z-scores, and provides entry/exit recommendations for market-neutral strategies. Use when user requests pair

Testing
994

lean4-theorem-proving

by cameronfreer

Use when developing Lean 4 proofs, facing type class synthesis errors, managing sorries/axioms, or searching mathlib - provides build-first workflow, instance management patterns (haveI/letI), and domain-specific tactics

Testing
9108