testing-code
Testing Code
AAA Pattern
Every test follows Arrange-Act-Assert:
it('should return user when found', () => {
// Arrange - set up test data and conditions
const mockUser = { id: '1', name: 'Alice' };
repository.findById.mockResolvedValue(mockUser);
// Act - execute the code under test
const result = await service.getUser('1');
More from mrwogu/promptscript
promptscript
>-
12committing
Creates well-structured git commits following conventional commit format. Use when committing changes, preparing commits, or when asked to commit code.
1refactoring
Improves code structure without changing behavior. Use when cleaning up code, reducing complexity, or when asked to refactor.
1pull-requesting
Creates well-structured pull requests with clear descriptions. Use when creating PRs, preparing changes for review, or when asked to open a pull request.
1code-reviewing
Reviews code for bugs, security issues, and quality improvements. Use when reviewing pull requests, checking code quality, or when asked to review changes.
1documenting
Creates clear, maintainable documentation for code and APIs. Use when writing README files, API docs, code comments, or when asked to document code.
1