Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:40:59 +08:00
commit fd99ef421d
11 changed files with 281 additions and 0 deletions

28
skills/testing/SKILL.md Normal file
View File

@@ -0,0 +1,28 @@
---
name: testing
description: Testing guidelines. Use when Writing, Editing, or reviewing tests.
---
# Testing Guidelines
## Test Naming
- Test names should not include the word "test"
## Assertions
- Test assertions should be strict
- Bad: `expect(content).to.include('valid-content')`
- Better: `expect(content).to.equal({ key: 'valid-content' })`
- Best: `expect(content).to.deep.equal({ key: 'valid-content' })`
## Mocking
- Use mocking as a last resort
- Don't mock a database, if it's possible to use an in-memory fake implementation instead
- Don't mock a larger API if we can mock a smaller API that it delegates to
- Prefer frameworks that record/replay network traffic over mocking
- Don't mock our own code
- Don't overuse the word "mock"
- Mocking means replacing behavior, by replacing method or function bodies, using a mocking framework
- In other cases use the words "fake" or "example"