From Napkin
Provides best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, async testing, snapshot testing, and React component testing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/napkin:javascript-typescript-jestThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- Name test files with `.test.ts` or `.test.js` suffix
.test.ts or .test.js suffix__tests__ directorydescribe('Component/Function/Class', () => { it('should do something', () => {}) })jest.mock() for module-level mocksjest.spyOn() for specific function mocksmockImplementation() or mockReturnValue() to define mock behaviorjest.resetAllMocks() in afterEachresolves/rejects matchers for promisesjest.setTimeout()userEvent over fireEvent for more realistic user interactionsexpect(value).toBe(expected), expect(value).toEqual(expected)expect(value).toBeTruthy(), expect(value).toBeFalsy()expect(value).toBeGreaterThan(3), expect(value).toBeLessThanOrEqual(3)expect(value).toMatch(/pattern/), expect(value).toContain('substring')expect(array).toContain(item), expect(array).toHaveLength(3)expect(object).toHaveProperty('key', value)expect(fn).toThrow(), expect(fn).toThrow(Error)expect(mockFn).toHaveBeenCalled(), expect(mockFn).toHaveBeenCalledWith(arg1, arg2)npx claudepluginhub ani1797/forge --plugin copilot-sdk2plugins reuse this skill
First indexed Jun 6, 2026
Generates Jest unit tests for JavaScript/TypeScript modules and React components with mocking, coverage, spies, and snapshots. Use for test creation, missing coverage, or improper mocking.
Generates Jest unit and integration tests in JavaScript or TypeScript, covering mocking, snapshots, async testing, and React component testing with Testing Library.
Provides Jest testing patterns for unit tests, mocks, spies, snapshots, setup/teardown, and matchers including equality, truthiness, numbers, strings, and arrays.