mirror of
https://github.com/greedychipmunk/agent-skills.git
synced 2026-09-14 20:46:42 +08:00
6.6 KiB
6.6 KiB
AngularJS Unit Testing Skill - Navigation Index
Version: 1.2 | Last Updated: January 10, 2026
Quick Navigation
📚 Main Documentation
- Skill Overview - Complete skill documentation with Jasmine + Jest support
📖 Resource Guides (Comprehensive References)
Core References
- AngularJS Testing Reference - Complete API reference for testing AngularJS components
- Testing Patterns Guide - 8+ proven testing patterns with examples
Advanced Topics
- HTTP Mocking Guide - Complete guide to $httpBackend mocking
- Mock Helpers & Spies - Service mocking and spy techniques
- Code Coverage Analysis - Coverage metrics and improvement strategies
- Jest Migration Guide - Guide for moving from Jasmine to Jest
Best Practices
- Best Practices Checklist - Quality assurance checklist and scoring
📝 Test Templates (Copy & Paste Ready)
- controller.spec.js - Full controller testing template (500+ lines)
- service.spec.js - Full service testing template (600+ lines)
- directive.spec.js - Directive testing template
- filter.spec.js - Filter testing template
- fixtures.js - Reusable test fixtures and helpers
🔧 Scripts
- run-tests.sh - Test execution script with coverage support
Getting Started
For New AngularJS Projects
- Read Skill Overview
- Review Testing Patterns Guide
- Use templates as starting points
- Reference Best Practices Checklist
For Jasmine Users
- Start with AngularJS Testing Reference
- Copy templates from
/templates/ - Follow Testing Patterns Guide
For Jest Users
- Read Jest Migration Guide
- Use Jest configuration section in Skill Overview
- Adapt templates as needed
For HTTP Testing
- Follow HTTP Mocking Guide
- See examples in service.spec.js
For Coverage Analysis
- Review Code Coverage Analysis
- Run tests with coverage:
./scripts/run-tests.sh --coverage
Common Tasks
| Task | Resource |
|---|---|
| Write controller tests | controller.spec.js + Testing Patterns |
| Write service tests | service.spec.js + HTTP Mocking Guide |
| Mock services | Mock Helpers Guide + fixtures.js |
| Test HTTP calls | HTTP Mocking Guide |
| Improve coverage | Code Coverage Analysis |
| Quality assurance | Best Practices Checklist |
| Migrate to Jest | Jest Migration Guide |
| Run tests | run-tests.sh |
Framework Comparison
Jasmine (Traditional, Recommended for AngularJS 1.x)
- Browser-based testing via Karma
- Tight AngularJS integration
- Mature ecosystem
- See all Jasmine content throughout resources
Jest (Modern, For New/Modern Projects)
- Node.js-based testing
- Fast parallel execution
- Built-in mocking and coverage
- Snapshot testing support
- See Jest Migration Guide
File Organization
angularjs-unit-testing-skill/
├── README.md (This file)
├── skill.md (Main documentation)
├── resources/ (Comprehensive guides)
│ ├── angularjs-testing-reference.md
│ ├── testing-patterns-guide.md
│ ├── http-mocking-guide.md
│ ├── mock-helpers-guide.md
│ ├── coverage-analysis-guide.md
│ ├── jest-migration-guide.md
│ └── best-practices-checklist.md
├── templates/ (Copy-paste ready templates)
│ ├── controller.spec.js (500+ lines, fully commented)
│ ├── service.spec.js (600+ lines, fully commented)
│ ├── directive.spec.js
│ ├── filter.spec.js
│ └── fixtures.js (Mock data and helpers)
└── scripts/ (Automation)
└── run-tests.sh (Test runner with coverage)
Quick Reference
Common Test Structure (Jasmine)
describe('Component', function() {
var component, $httpBackend;
beforeEach(module('app'));
beforeEach(inject(function(_Component_, _$httpBackend_) {
component = _Component_;
$httpBackend = _$httpBackend_;
}));
it('should do something', function() {
expect(component).toBeDefined();
});
});
Common Test Structure (Jest)
describe('Component', () => {
let component;
beforeEach(() => {
component = new Component();
});
test('should do something', () => {
expect(component).toBeDefined();
});
});
Documentation Stats
- Total Documentation: 27,500+ words
- Code Examples: 200+ examples with dual-framework support
- Test Templates: 5 production-ready templates (2,000+ lines)
- Resource Guides: 7 comprehensive guides
- Test Patterns: 8+ documented patterns
- Coverage: Jasmine + Jest support throughout
Support & References
- AngularJS Documentation
- Jasmine Documentation
- Jest Documentation
- Karma Test Runner
- Istanbul/NYC Coverage
Version History
- v1.2 - Added Jest migration guide and expanded mock helpers (Jan 10, 2026)
- v1.1 - Added Jasmine + Jest dual-framework support (Jan 8, 2026)
- v1.0 - Initial release with Jasmine-focused content (Jan 1, 2026)
Need help? Review the Best Practices Checklist or start with a template matching your component type.