@the-bearded-bear/claude-craft 3.1.2 → 3.3.1-next.f4f0d1e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dev/i18n/de/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/de/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/de/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/de/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/de/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/de/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/de/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/de/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/de/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/de/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/de/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/de/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/de/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/de/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/de/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/de/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/de/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/de/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/de/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/de/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/de/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/de/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/de/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/de/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/de/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/de/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/de/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/de/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/de/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/de/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/de/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/de/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/de/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/de/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/de/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/de/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/de/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/de/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/de/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/de/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/de/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/de/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/de/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/de/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/de/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/de/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/de/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/de/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/de/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/de/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/de/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/de/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/de/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/de/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/de/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/de/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/de/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/de/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/de/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/de/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/de/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/de/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/de/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/de/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/de/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/de/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/de/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/de/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/de/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/de/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/de/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/de/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/de/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/de/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/de/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/de/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/de/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/de/PHP/templates/entity.md +435 -0
- package/Dev/i18n/de/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/de/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/de/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/de/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/de/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/de/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/de/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/de/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/de/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/de/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/de/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/de/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/de/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/de/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/de/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/de/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/de/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/de/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/de/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/de/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/de/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/de/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/de/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/en/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/en/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/en/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/en/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/en/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/en/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/en/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/en/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/en/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/en/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/en/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/en/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/en/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/en/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/en/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/en/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/en/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/en/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/en/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/en/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/en/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/en/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/en/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/en/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/en/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/en/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/en/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/en/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/en/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/en/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/en/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/en/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/en/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/en/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/en/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/en/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/en/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/en/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/en/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/en/Common/commands/add-technology.md +293 -0
- package/Dev/i18n/en/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/en/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/en/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/en/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/en/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/en/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/en/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/en/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/en/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/en/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/en/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/en/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/en/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/en/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/en/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/en/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/en/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/en/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/en/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/en/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/en/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/en/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/en/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/en/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/en/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/en/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/en/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/en/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/en/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/en/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/en/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/en/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/en/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/en/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/en/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/en/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/en/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/en/PHP/templates/entity.md +435 -0
- package/Dev/i18n/en/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/en/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/en/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/en/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/en/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/en/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/en/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/en/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/en/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/en/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/en/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/en/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/en/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/en/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/en/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/en/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/en/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/en/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/en/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/en/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/en/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/en/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/en/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/es/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/es/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/es/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/es/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/es/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/es/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/es/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/es/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/es/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/es/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/es/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/es/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/es/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/es/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/es/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/es/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/es/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/es/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/es/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/es/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/es/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/es/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/es/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/es/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/es/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/es/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/es/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/es/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/es/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/es/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/es/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/es/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/es/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/es/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/es/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/es/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/es/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/es/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/es/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/es/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/es/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/es/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/es/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/es/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/es/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/es/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/es/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/es/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/es/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/es/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/es/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/es/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/es/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/es/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/es/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/es/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/es/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/es/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/es/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/es/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/es/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/es/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/es/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/es/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/es/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/es/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/es/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/es/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/es/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/es/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/es/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/es/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/es/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/es/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/es/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/es/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/es/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/es/PHP/templates/entity.md +435 -0
- package/Dev/i18n/es/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/es/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/es/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/es/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/es/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/es/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/es/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/es/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/es/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/es/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/es/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/es/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/es/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/es/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/es/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/es/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/es/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/es/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/es/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/es/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/es/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/es/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/es/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/fr/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/fr/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/fr/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/fr/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/fr/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/fr/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/fr/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/fr/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/fr/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/fr/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/fr/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/fr/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/fr/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/fr/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/fr/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/fr/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/fr/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/fr/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/fr/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/fr/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/fr/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/fr/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/fr/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/fr/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/fr/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/fr/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/fr/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/fr/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/fr/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/fr/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/fr/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/fr/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/fr/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/fr/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/fr/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/fr/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/fr/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/fr/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/fr/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/fr/Common/commands/add-technology.md +293 -0
- package/Dev/i18n/fr/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/fr/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/fr/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/fr/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/fr/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/fr/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/fr/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/fr/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/fr/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/fr/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/fr/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/fr/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/fr/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/fr/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/fr/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/fr/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/fr/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/fr/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/fr/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/fr/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/fr/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/fr/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/fr/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/fr/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/fr/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/fr/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/fr/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/fr/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/fr/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/fr/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/fr/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/fr/PHP/rules/02-architecture-php.md +506 -0
- package/Dev/i18n/fr/PHP/rules/03-coding-standards.md +585 -0
- package/Dev/i18n/fr/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/fr/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/fr/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/fr/PHP/rules/11-security-php.md +642 -0
- package/Dev/i18n/fr/PHP/templates/entity.md +435 -0
- package/Dev/i18n/fr/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/fr/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/fr/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/fr/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/fr/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/fr/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/fr/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/fr/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/fr/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/fr/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/fr/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/fr/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/fr/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/fr/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/fr/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/fr/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/fr/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/fr/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/fr/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/fr/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/fr/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/fr/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/fr/VueJS/templates/test.template.ts +233 -0
- package/Dev/i18n/pt/Angular/CLAUDE.md.template +49 -0
- package/Dev/i18n/pt/Angular/agents/angular-reviewer.md +213 -0
- package/Dev/i18n/pt/Angular/checklists/new-feature.md +125 -0
- package/Dev/i18n/pt/Angular/checklists/pre-commit.md +77 -0
- package/Dev/i18n/pt/Angular/commands/check-architecture.md +261 -0
- package/Dev/i18n/pt/Angular/commands/check-code-quality.md +238 -0
- package/Dev/i18n/pt/Angular/commands/check-compliance.md +199 -0
- package/Dev/i18n/pt/Angular/commands/check-security.md +263 -0
- package/Dev/i18n/pt/Angular/commands/check-testing.md +292 -0
- package/Dev/i18n/pt/Angular/commands/generate-component.md +220 -0
- package/Dev/i18n/pt/Angular/rules/00-project-context.md.template +78 -0
- package/Dev/i18n/pt/Angular/rules/02-architecture-angular.md +477 -0
- package/Dev/i18n/pt/Angular/rules/03-coding-standards.md +640 -0
- package/Dev/i18n/pt/Angular/rules/06-tooling.md +516 -0
- package/Dev/i18n/pt/Angular/rules/07-testing-angular.md +739 -0
- package/Dev/i18n/pt/Angular/rules/08-quality-tools.md +501 -0
- package/Dev/i18n/pt/Angular/rules/11-security-angular.md +497 -0
- package/Dev/i18n/pt/Angular/templates/component.template.ts +115 -0
- package/Dev/i18n/pt/Angular/templates/service.template.ts +203 -0
- package/Dev/i18n/pt/CSharp/CLAUDE.md.template +65 -0
- package/Dev/i18n/pt/CSharp/agents/csharp-reviewer.md +166 -0
- package/Dev/i18n/pt/CSharp/checklists/new-feature.md +178 -0
- package/Dev/i18n/pt/CSharp/checklists/pre-commit.md +126 -0
- package/Dev/i18n/pt/CSharp/commands/check-architecture.md +294 -0
- package/Dev/i18n/pt/CSharp/commands/check-code-quality.md +355 -0
- package/Dev/i18n/pt/CSharp/commands/check-compliance.md +178 -0
- package/Dev/i18n/pt/CSharp/commands/check-security.md +369 -0
- package/Dev/i18n/pt/CSharp/commands/check-testing.md +295 -0
- package/Dev/i18n/pt/CSharp/commands/generate-feature.md +481 -0
- package/Dev/i18n/pt/CSharp/rules/00-project-context.md.template +100 -0
- package/Dev/i18n/pt/CSharp/rules/02-architecture-csharp.md +536 -0
- package/Dev/i18n/pt/CSharp/rules/03-coding-standards.md +494 -0
- package/Dev/i18n/pt/CSharp/rules/06-tooling.md +493 -0
- package/Dev/i18n/pt/CSharp/rules/07-testing-csharp.md +566 -0
- package/Dev/i18n/pt/CSharp/rules/08-quality-tools.md +497 -0
- package/Dev/i18n/pt/CSharp/rules/11-security-csharp.md +568 -0
- package/Dev/i18n/pt/CSharp/rules/12-aspire-cloud-native.md +514 -0
- package/Dev/i18n/pt/CSharp/templates/command-handler.template.cs +100 -0
- package/Dev/i18n/pt/CSharp/templates/entity.template.cs +159 -0
- package/Dev/i18n/pt/Common/commands/add-technology.md +195 -0
- package/Dev/i18n/pt/Laravel/CLAUDE.md.template +104 -0
- package/Dev/i18n/pt/Laravel/agents/laravel-reviewer.md +200 -0
- package/Dev/i18n/pt/Laravel/checklists/new-feature.md +277 -0
- package/Dev/i18n/pt/Laravel/checklists/pre-commit.md +156 -0
- package/Dev/i18n/pt/Laravel/commands/check-architecture.md +306 -0
- package/Dev/i18n/pt/Laravel/commands/check-code-quality.md +302 -0
- package/Dev/i18n/pt/Laravel/commands/check-compliance.md +141 -0
- package/Dev/i18n/pt/Laravel/commands/check-security.md +372 -0
- package/Dev/i18n/pt/Laravel/commands/check-testing.md +397 -0
- package/Dev/i18n/pt/Laravel/commands/generate-controller.md +388 -0
- package/Dev/i18n/pt/Laravel/rules/00-project-context.md.template +140 -0
- package/Dev/i18n/pt/Laravel/rules/02-architecture-laravel.md +644 -0
- package/Dev/i18n/pt/Laravel/rules/03-coding-standards.md +573 -0
- package/Dev/i18n/pt/Laravel/rules/06-tooling.md +580 -0
- package/Dev/i18n/pt/Laravel/rules/07-testing-laravel.md +525 -0
- package/Dev/i18n/pt/Laravel/rules/08-quality-tools.md +591 -0
- package/Dev/i18n/pt/Laravel/rules/11-security-laravel.md +787 -0
- package/Dev/i18n/pt/Laravel/templates/action.template.php +79 -0
- package/Dev/i18n/pt/Laravel/templates/controller.template.php +99 -0
- package/Dev/i18n/pt/Laravel/templates/model.template.php +206 -0
- package/Dev/i18n/pt/Laravel/templates/test.template.php +263 -0
- package/Dev/i18n/pt/PHP/CLAUDE.md.template +460 -0
- package/Dev/i18n/pt/PHP/agents/php-reviewer.md +345 -0
- package/Dev/i18n/pt/PHP/checklists/new-feature.md +132 -0
- package/Dev/i18n/pt/PHP/checklists/pre-commit.md +231 -0
- package/Dev/i18n/pt/PHP/commands/check-architecture.md +557 -0
- package/Dev/i18n/pt/PHP/commands/check-code-quality.md +448 -0
- package/Dev/i18n/pt/PHP/commands/check-compliance.md +477 -0
- package/Dev/i18n/pt/PHP/commands/check-security.md +420 -0
- package/Dev/i18n/pt/PHP/commands/check-testing.md +486 -0
- package/Dev/i18n/pt/PHP/rules/00-project-context.md.template +266 -0
- package/Dev/i18n/pt/PHP/rules/02-architecture-php.md +696 -0
- package/Dev/i18n/pt/PHP/rules/03-coding-standards.md +641 -0
- package/Dev/i18n/pt/PHP/rules/06-tooling.md +543 -0
- package/Dev/i18n/pt/PHP/rules/07-testing-php.md +636 -0
- package/Dev/i18n/pt/PHP/rules/08-quality-tools.md +533 -0
- package/Dev/i18n/pt/PHP/rules/11-security-php.md +759 -0
- package/Dev/i18n/pt/PHP/templates/entity.md +435 -0
- package/Dev/i18n/pt/PHP/templates/use-case.md +512 -0
- package/Dev/i18n/pt/PHP/templates/value-object.md +555 -0
- package/Dev/i18n/pt/VueJS/CLAUDE.md.template +102 -0
- package/Dev/i18n/pt/VueJS/agents/vuejs-reviewer.md +206 -0
- package/Dev/i18n/pt/VueJS/checklists/new-feature.md +131 -0
- package/Dev/i18n/pt/VueJS/checklists/pre-commit.md +68 -0
- package/Dev/i18n/pt/VueJS/commands/check-architecture.md +137 -0
- package/Dev/i18n/pt/VueJS/commands/check-code-quality.md +152 -0
- package/Dev/i18n/pt/VueJS/commands/check-compliance.md +124 -0
- package/Dev/i18n/pt/VueJS/commands/check-security.md +186 -0
- package/Dev/i18n/pt/VueJS/commands/check-testing.md +185 -0
- package/Dev/i18n/pt/VueJS/commands/generate-component.md +233 -0
- package/Dev/i18n/pt/VueJS/rules/00-project-context.md.template +125 -0
- package/Dev/i18n/pt/VueJS/rules/02-architecture-vuejs.md +375 -0
- package/Dev/i18n/pt/VueJS/rules/03-coding-standards.md +502 -0
- package/Dev/i18n/pt/VueJS/rules/06-tooling.md +422 -0
- package/Dev/i18n/pt/VueJS/rules/07-testing-vuejs.md +606 -0
- package/Dev/i18n/pt/VueJS/rules/08-quality-tools.md +441 -0
- package/Dev/i18n/pt/VueJS/rules/11-security-vuejs.md +465 -0
- package/Dev/i18n/pt/VueJS/templates/component.template.vue +133 -0
- package/Dev/i18n/pt/VueJS/templates/composable.template.ts +162 -0
- package/Dev/i18n/pt/VueJS/templates/store.template.ts +282 -0
- package/Dev/i18n/pt/VueJS/templates/test.template.ts +233 -0
- package/Dev/scripts/install-angular-rules.sh +543 -0
- package/Dev/scripts/install-common-rules.sh +13 -1
- package/Dev/scripts/install-csharp-rules.sh +544 -0
- package/Dev/scripts/install-flutter-rules.sh +17 -4
- package/Dev/scripts/install-from-config.sh +61 -23
- package/Dev/scripts/install-laravel-rules.sh +552 -0
- package/Dev/scripts/install-php-rules.sh +537 -0
- package/Dev/scripts/install-python-rules.sh +17 -4
- package/Dev/scripts/install-react-rules.sh +17 -4
- package/Dev/scripts/install-reactnative-rules.sh +17 -4
- package/Dev/scripts/install-symfony-rules.sh +22 -4
- package/Dev/scripts/install-vuejs-rules.sh +588 -0
- package/README.md +68 -2
- package/Tools/Ralph/README.md +106 -10
- package/Tools/Ralph/lib/checkpoint.sh +15 -9
- package/Tools/Ralph/lib/circuit-breaker.sh +16 -7
- package/Tools/Ralph/lib/context-manager.sh +473 -0
- package/Tools/Ralph/lib/context-reconstruction.sh +329 -0
- package/Tools/Ralph/lib/dod-validator.sh +17 -4
- package/Tools/Ralph/lib/loop.sh +33 -10
- package/Tools/Ralph/lib/session.sh +88 -33
- package/Tools/Ralph/lib/sprint-progress.sh +832 -0
- package/Tools/Ralph/lib/utils.sh +362 -0
- package/Tools/Ralph/ralph.sh +172 -14
- package/Tools/Ralph/templates/ralph.yml.template +87 -0
- package/Tools/Ralph/templates/sprint-progress.md.template +72 -0
- package/Tools/i18n/ralph/de.sh +31 -0
- package/Tools/i18n/ralph/en.sh +31 -0
- package/Tools/i18n/ralph/es.sh +31 -0
- package/Tools/i18n/ralph/fr.sh +31 -0
- package/Tools/i18n/ralph/pt.sh +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
# Angular Testing Standards
|
|
2
|
+
|
|
3
|
+
## Testing Strategy
|
|
4
|
+
|
|
5
|
+
### Testing Pyramid
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/\
|
|
9
|
+
/ \ E2E Tests (Cypress/Playwright)
|
|
10
|
+
/----\ 10% - Critical user journeys
|
|
11
|
+
/ \
|
|
12
|
+
/--------\ Integration Tests
|
|
13
|
+
/ \ 20% - Component interactions
|
|
14
|
+
/------------\
|
|
15
|
+
/ \ Unit Tests
|
|
16
|
+
/________________\ 70% - Components, services, pipes
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Coverage Requirements
|
|
20
|
+
|
|
21
|
+
| Metric | Minimum | Target |
|
|
22
|
+
|--------|---------|--------|
|
|
23
|
+
| Lines | 80% | 90% |
|
|
24
|
+
| Functions | 80% | 90% |
|
|
25
|
+
| Branches | 75% | 85% |
|
|
26
|
+
| Statements | 80% | 90% |
|
|
27
|
+
|
|
28
|
+
## Unit Testing with Vitest (Recommended)
|
|
29
|
+
|
|
30
|
+
### Setup
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -D vitest @analogjs/vitest-angular jsdom
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**vite.config.ts**
|
|
37
|
+
```typescript
|
|
38
|
+
import { defineConfig } from 'vite';
|
|
39
|
+
import angular from '@analogjs/vite-plugin-angular';
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
plugins: [angular()],
|
|
43
|
+
test: {
|
|
44
|
+
globals: true,
|
|
45
|
+
environment: 'jsdom',
|
|
46
|
+
setupFiles: ['src/test-setup.ts'],
|
|
47
|
+
include: ['src/**/*.spec.ts'],
|
|
48
|
+
coverage: {
|
|
49
|
+
provider: 'v8',
|
|
50
|
+
reporter: ['text', 'html', 'lcov'],
|
|
51
|
+
include: ['src/app/**/*.ts'],
|
|
52
|
+
exclude: ['src/app/**/*.module.ts', 'src/app/**/*.routes.ts']
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**src/test-setup.ts**
|
|
59
|
+
```typescript
|
|
60
|
+
import '@analogjs/vitest-angular/setup-zone';
|
|
61
|
+
import { getTestBed } from '@angular/core/testing';
|
|
62
|
+
import {
|
|
63
|
+
BrowserDynamicTestingModule,
|
|
64
|
+
platformBrowserDynamicTesting
|
|
65
|
+
} from '@angular/platform-browser-dynamic/testing';
|
|
66
|
+
|
|
67
|
+
getTestBed().initTestEnvironment(
|
|
68
|
+
BrowserDynamicTestingModule,
|
|
69
|
+
platformBrowserDynamicTesting()
|
|
70
|
+
);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Component Testing
|
|
74
|
+
|
|
75
|
+
### Basic Component Test
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// user-card.component.spec.ts
|
|
79
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
80
|
+
import { UserCardComponent } from './user-card.component';
|
|
81
|
+
|
|
82
|
+
describe('UserCardComponent', () => {
|
|
83
|
+
let component: UserCardComponent;
|
|
84
|
+
let fixture: ComponentFixture<UserCardComponent>;
|
|
85
|
+
|
|
86
|
+
beforeEach(async () => {
|
|
87
|
+
await TestBed.configureTestingModule({
|
|
88
|
+
imports: [UserCardComponent]
|
|
89
|
+
}).compileComponents();
|
|
90
|
+
|
|
91
|
+
fixture = TestBed.createComponent(UserCardComponent);
|
|
92
|
+
component = fixture.componentInstance;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should create', () => {
|
|
96
|
+
expect(component).toBeTruthy();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should display user name', () => {
|
|
100
|
+
// Arrange
|
|
101
|
+
const user = { id: '1', name: 'John Doe', email: 'john@example.com' };
|
|
102
|
+
|
|
103
|
+
// Act
|
|
104
|
+
fixture.componentRef.setInput('user', user);
|
|
105
|
+
fixture.detectChanges();
|
|
106
|
+
|
|
107
|
+
// Assert
|
|
108
|
+
const element = fixture.nativeElement;
|
|
109
|
+
expect(element.textContent).toContain('John Doe');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should emit selected event when clicked', () => {
|
|
113
|
+
// Arrange
|
|
114
|
+
const user = { id: '1', name: 'John Doe', email: 'john@example.com' };
|
|
115
|
+
fixture.componentRef.setInput('user', user);
|
|
116
|
+
fixture.detectChanges();
|
|
117
|
+
|
|
118
|
+
const spy = vi.fn();
|
|
119
|
+
component.selected.subscribe(spy);
|
|
120
|
+
|
|
121
|
+
// Act
|
|
122
|
+
const button = fixture.nativeElement.querySelector('button');
|
|
123
|
+
button.click();
|
|
124
|
+
|
|
125
|
+
// Assert
|
|
126
|
+
expect(spy).toHaveBeenCalledWith('1');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Testing Components with Signals
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// counter.component.spec.ts
|
|
135
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
136
|
+
import { CounterComponent } from './counter.component';
|
|
137
|
+
|
|
138
|
+
describe('CounterComponent', () => {
|
|
139
|
+
let component: CounterComponent;
|
|
140
|
+
let fixture: ComponentFixture<CounterComponent>;
|
|
141
|
+
|
|
142
|
+
beforeEach(async () => {
|
|
143
|
+
await TestBed.configureTestingModule({
|
|
144
|
+
imports: [CounterComponent]
|
|
145
|
+
}).compileComponents();
|
|
146
|
+
|
|
147
|
+
fixture = TestBed.createComponent(CounterComponent);
|
|
148
|
+
component = fixture.componentInstance;
|
|
149
|
+
fixture.detectChanges();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should initialize with count 0', () => {
|
|
153
|
+
expect(component.count()).toBe(0);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should increment count', () => {
|
|
157
|
+
// Act
|
|
158
|
+
component.increment();
|
|
159
|
+
|
|
160
|
+
// Assert
|
|
161
|
+
expect(component.count()).toBe(1);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('should compute double count', () => {
|
|
165
|
+
// Act
|
|
166
|
+
component.count.set(5);
|
|
167
|
+
|
|
168
|
+
// Assert
|
|
169
|
+
expect(component.doubleCount()).toBe(10);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should update view when count changes', () => {
|
|
173
|
+
// Act
|
|
174
|
+
component.count.set(42);
|
|
175
|
+
fixture.detectChanges();
|
|
176
|
+
|
|
177
|
+
// Assert
|
|
178
|
+
const element = fixture.nativeElement;
|
|
179
|
+
expect(element.textContent).toContain('42');
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Testing Components with Dependencies
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// user-list.component.spec.ts
|
|
188
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
189
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
190
|
+
import { provideHttpClientTesting, HttpTestingController } from '@angular/common/http/testing';
|
|
191
|
+
import { UserListComponent } from './user-list.component';
|
|
192
|
+
import { UsersService } from './users.service';
|
|
193
|
+
|
|
194
|
+
describe('UserListComponent', () => {
|
|
195
|
+
let component: UserListComponent;
|
|
196
|
+
let fixture: ComponentFixture<UserListComponent>;
|
|
197
|
+
let httpMock: HttpTestingController;
|
|
198
|
+
|
|
199
|
+
beforeEach(async () => {
|
|
200
|
+
await TestBed.configureTestingModule({
|
|
201
|
+
imports: [UserListComponent],
|
|
202
|
+
providers: [
|
|
203
|
+
UsersService,
|
|
204
|
+
provideHttpClient(),
|
|
205
|
+
provideHttpClientTesting()
|
|
206
|
+
]
|
|
207
|
+
}).compileComponents();
|
|
208
|
+
|
|
209
|
+
fixture = TestBed.createComponent(UserListComponent);
|
|
210
|
+
component = fixture.componentInstance;
|
|
211
|
+
httpMock = TestBed.inject(HttpTestingController);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
afterEach(() => {
|
|
215
|
+
httpMock.verify();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('should load users on init', () => {
|
|
219
|
+
// Arrange
|
|
220
|
+
const mockUsers = [
|
|
221
|
+
{ id: '1', name: 'John' },
|
|
222
|
+
{ id: '2', name: 'Jane' }
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
// Act
|
|
226
|
+
fixture.detectChanges();
|
|
227
|
+
|
|
228
|
+
// Assert - Handle HTTP request
|
|
229
|
+
const req = httpMock.expectOne('/api/users');
|
|
230
|
+
expect(req.request.method).toBe('GET');
|
|
231
|
+
req.flush(mockUsers);
|
|
232
|
+
|
|
233
|
+
fixture.detectChanges();
|
|
234
|
+
expect(component.users().length).toBe(2);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Testing with Mocks
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
// user-profile.component.spec.ts
|
|
243
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
244
|
+
import { signal } from '@angular/core';
|
|
245
|
+
import { UserProfileComponent } from './user-profile.component';
|
|
246
|
+
import { AuthService } from '@core/services/auth.service';
|
|
247
|
+
|
|
248
|
+
describe('UserProfileComponent', () => {
|
|
249
|
+
let component: UserProfileComponent;
|
|
250
|
+
let fixture: ComponentFixture<UserProfileComponent>;
|
|
251
|
+
let mockAuthService: Partial<AuthService>;
|
|
252
|
+
|
|
253
|
+
beforeEach(async () => {
|
|
254
|
+
// Create mock
|
|
255
|
+
mockAuthService = {
|
|
256
|
+
currentUser: signal({ id: '1', name: 'John', email: 'john@test.com' }),
|
|
257
|
+
isAuthenticated: signal(true),
|
|
258
|
+
logout: vi.fn()
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
await TestBed.configureTestingModule({
|
|
262
|
+
imports: [UserProfileComponent],
|
|
263
|
+
providers: [
|
|
264
|
+
{ provide: AuthService, useValue: mockAuthService }
|
|
265
|
+
]
|
|
266
|
+
}).compileComponents();
|
|
267
|
+
|
|
268
|
+
fixture = TestBed.createComponent(UserProfileComponent);
|
|
269
|
+
component = fixture.componentInstance;
|
|
270
|
+
fixture.detectChanges();
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('should display current user name', () => {
|
|
274
|
+
const element = fixture.nativeElement;
|
|
275
|
+
expect(element.textContent).toContain('John');
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should call logout on AuthService', () => {
|
|
279
|
+
// Act
|
|
280
|
+
component.onLogout();
|
|
281
|
+
|
|
282
|
+
// Assert
|
|
283
|
+
expect(mockAuthService.logout).toHaveBeenCalled();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Service Testing
|
|
289
|
+
|
|
290
|
+
### API Service Test
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
// users-api.service.spec.ts
|
|
294
|
+
import { TestBed } from '@angular/core/testing';
|
|
295
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
296
|
+
import { provideHttpClientTesting, HttpTestingController } from '@angular/common/http/testing';
|
|
297
|
+
import { UsersApiService } from './users-api.service';
|
|
298
|
+
|
|
299
|
+
describe('UsersApiService', () => {
|
|
300
|
+
let service: UsersApiService;
|
|
301
|
+
let httpMock: HttpTestingController;
|
|
302
|
+
|
|
303
|
+
beforeEach(() => {
|
|
304
|
+
TestBed.configureTestingModule({
|
|
305
|
+
providers: [
|
|
306
|
+
UsersApiService,
|
|
307
|
+
provideHttpClient(),
|
|
308
|
+
provideHttpClientTesting()
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
service = TestBed.inject(UsersApiService);
|
|
313
|
+
httpMock = TestBed.inject(HttpTestingController);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
afterEach(() => {
|
|
317
|
+
httpMock.verify();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
describe('getAll', () => {
|
|
321
|
+
it('should return users list', () => {
|
|
322
|
+
const mockUsers = [
|
|
323
|
+
{ id: '1', name: 'John' },
|
|
324
|
+
{ id: '2', name: 'Jane' }
|
|
325
|
+
];
|
|
326
|
+
|
|
327
|
+
service.getAll().subscribe(users => {
|
|
328
|
+
expect(users.length).toBe(2);
|
|
329
|
+
expect(users[0].name).toBe('John');
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
const req = httpMock.expectOne('/api/users?page=1&limit=10');
|
|
333
|
+
expect(req.request.method).toBe('GET');
|
|
334
|
+
req.flush(mockUsers);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('should pass pagination params', () => {
|
|
338
|
+
service.getAll(2, 20).subscribe();
|
|
339
|
+
|
|
340
|
+
const req = httpMock.expectOne('/api/users?page=2&limit=20');
|
|
341
|
+
expect(req.request.params.get('page')).toBe('2');
|
|
342
|
+
expect(req.request.params.get('limit')).toBe('20');
|
|
343
|
+
req.flush([]);
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
describe('create', () => {
|
|
348
|
+
it('should send POST request with user data', () => {
|
|
349
|
+
const newUser = { name: 'Test', email: 'test@example.com' };
|
|
350
|
+
const createdUser = { id: '3', ...newUser };
|
|
351
|
+
|
|
352
|
+
service.create(newUser).subscribe(user => {
|
|
353
|
+
expect(user.id).toBe('3');
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
const req = httpMock.expectOne('/api/users');
|
|
357
|
+
expect(req.request.method).toBe('POST');
|
|
358
|
+
expect(req.request.body).toEqual(newUser);
|
|
359
|
+
req.flush(createdUser);
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
describe('error handling', () => {
|
|
364
|
+
it('should handle 404 error', () => {
|
|
365
|
+
service.getById('999').subscribe({
|
|
366
|
+
error: (error) => {
|
|
367
|
+
expect(error.status).toBe(404);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
const req = httpMock.expectOne('/api/users/999');
|
|
372
|
+
req.flush('Not Found', { status: 404, statusText: 'Not Found' });
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Store Service Test
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
// users.store.spec.ts
|
|
382
|
+
import { TestBed } from '@angular/core/testing';
|
|
383
|
+
import { UsersStore } from './users.store';
|
|
384
|
+
|
|
385
|
+
describe('UsersStore', () => {
|
|
386
|
+
let store: UsersStore;
|
|
387
|
+
|
|
388
|
+
beforeEach(() => {
|
|
389
|
+
TestBed.configureTestingModule({
|
|
390
|
+
providers: [UsersStore]
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
store = TestBed.inject(UsersStore);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('should initialize with empty state', () => {
|
|
397
|
+
expect(store.users()).toEqual([]);
|
|
398
|
+
expect(store.loading()).toBe(false);
|
|
399
|
+
expect(store.error()).toBeNull();
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
describe('setUsers', () => {
|
|
403
|
+
it('should update users and clear loading', () => {
|
|
404
|
+
const users = [{ id: '1', name: 'John' }];
|
|
405
|
+
|
|
406
|
+
store.setLoading(true);
|
|
407
|
+
store.setUsers(users);
|
|
408
|
+
|
|
409
|
+
expect(store.users()).toEqual(users);
|
|
410
|
+
expect(store.loading()).toBe(false);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
describe('addUser', () => {
|
|
415
|
+
it('should add user to list', () => {
|
|
416
|
+
const user = { id: '1', name: 'John' };
|
|
417
|
+
|
|
418
|
+
store.addUser(user);
|
|
419
|
+
|
|
420
|
+
expect(store.users()).toContainEqual(user);
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
describe('selectedUser', () => {
|
|
425
|
+
it('should return selected user', () => {
|
|
426
|
+
const users = [
|
|
427
|
+
{ id: '1', name: 'John' },
|
|
428
|
+
{ id: '2', name: 'Jane' }
|
|
429
|
+
];
|
|
430
|
+
|
|
431
|
+
store.setUsers(users);
|
|
432
|
+
store.selectUser('2');
|
|
433
|
+
|
|
434
|
+
expect(store.selectedUser()?.name).toBe('Jane');
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
it('should return undefined if no user selected', () => {
|
|
438
|
+
expect(store.selectedUser()).toBeUndefined();
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
describe('reset', () => {
|
|
443
|
+
it('should reset to initial state', () => {
|
|
444
|
+
store.setUsers([{ id: '1', name: 'John' }]);
|
|
445
|
+
store.setLoading(true);
|
|
446
|
+
store.setError('Error');
|
|
447
|
+
|
|
448
|
+
store.reset();
|
|
449
|
+
|
|
450
|
+
expect(store.users()).toEqual([]);
|
|
451
|
+
expect(store.loading()).toBe(false);
|
|
452
|
+
expect(store.error()).toBeNull();
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Pipe Testing
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
// date-format.pipe.spec.ts
|
|
462
|
+
import { DateFormatPipe } from './date-format.pipe';
|
|
463
|
+
|
|
464
|
+
describe('DateFormatPipe', () => {
|
|
465
|
+
let pipe: DateFormatPipe;
|
|
466
|
+
|
|
467
|
+
beforeEach(() => {
|
|
468
|
+
pipe = new DateFormatPipe();
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
it('should create', () => {
|
|
472
|
+
expect(pipe).toBeTruthy();
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
it('should format date with default format', () => {
|
|
476
|
+
const date = new Date('2024-03-15T10:30:00');
|
|
477
|
+
expect(pipe.transform(date)).toBe('Mar 15, 2024');
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it('should format date with custom format', () => {
|
|
481
|
+
const date = new Date('2024-03-15T10:30:00');
|
|
482
|
+
expect(pipe.transform(date, 'short')).toBe('3/15/24');
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it('should return empty string for null', () => {
|
|
486
|
+
expect(pipe.transform(null)).toBe('');
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
it('should handle invalid date', () => {
|
|
490
|
+
expect(pipe.transform('invalid')).toBe('Invalid Date');
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## Guard Testing
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
// auth.guard.spec.ts
|
|
499
|
+
import { TestBed } from '@angular/core/testing';
|
|
500
|
+
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
501
|
+
import { signal } from '@angular/core';
|
|
502
|
+
import { authGuard } from './auth.guard';
|
|
503
|
+
import { AuthService } from '../services/auth.service';
|
|
504
|
+
|
|
505
|
+
describe('authGuard', () => {
|
|
506
|
+
let mockAuthService: Partial<AuthService>;
|
|
507
|
+
let mockRouter: Partial<Router>;
|
|
508
|
+
|
|
509
|
+
beforeEach(() => {
|
|
510
|
+
mockAuthService = {
|
|
511
|
+
isAuthenticated: signal(false)
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
mockRouter = {
|
|
515
|
+
createUrlTree: vi.fn().mockReturnValue('/auth/login')
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
TestBed.configureTestingModule({
|
|
519
|
+
providers: [
|
|
520
|
+
{ provide: AuthService, useValue: mockAuthService },
|
|
521
|
+
{ provide: Router, useValue: mockRouter }
|
|
522
|
+
]
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
it('should allow access when authenticated', () => {
|
|
527
|
+
mockAuthService.isAuthenticated = signal(true);
|
|
528
|
+
|
|
529
|
+
TestBed.runInInjectionContext(() => {
|
|
530
|
+
const result = authGuard({} as ActivatedRouteSnapshot, {} as RouterStateSnapshot);
|
|
531
|
+
expect(result).toBe(true);
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it('should redirect to login when not authenticated', () => {
|
|
536
|
+
mockAuthService.isAuthenticated = signal(false);
|
|
537
|
+
|
|
538
|
+
TestBed.runInInjectionContext(() => {
|
|
539
|
+
const result = authGuard({} as ActivatedRouteSnapshot, {} as RouterStateSnapshot);
|
|
540
|
+
expect(mockRouter.createUrlTree).toHaveBeenCalledWith(['/auth/login']);
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## Interceptor Testing
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
// auth.interceptor.spec.ts
|
|
550
|
+
import { TestBed } from '@angular/core/testing';
|
|
551
|
+
import { HttpClient, provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
552
|
+
import { provideHttpClientTesting, HttpTestingController } from '@angular/common/http/testing';
|
|
553
|
+
import { authInterceptor } from './auth.interceptor';
|
|
554
|
+
import { AuthService } from '../services/auth.service';
|
|
555
|
+
|
|
556
|
+
describe('authInterceptor', () => {
|
|
557
|
+
let http: HttpClient;
|
|
558
|
+
let httpMock: HttpTestingController;
|
|
559
|
+
let mockAuthService: Partial<AuthService>;
|
|
560
|
+
|
|
561
|
+
beforeEach(() => {
|
|
562
|
+
mockAuthService = {
|
|
563
|
+
getToken: vi.fn().mockReturnValue('test-token'),
|
|
564
|
+
logout: vi.fn()
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
TestBed.configureTestingModule({
|
|
568
|
+
providers: [
|
|
569
|
+
{ provide: AuthService, useValue: mockAuthService },
|
|
570
|
+
provideHttpClient(withInterceptors([authInterceptor])),
|
|
571
|
+
provideHttpClientTesting()
|
|
572
|
+
]
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
http = TestBed.inject(HttpClient);
|
|
576
|
+
httpMock = TestBed.inject(HttpTestingController);
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
afterEach(() => {
|
|
580
|
+
httpMock.verify();
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
it('should add Authorization header', () => {
|
|
584
|
+
http.get('/api/data').subscribe();
|
|
585
|
+
|
|
586
|
+
const req = httpMock.expectOne('/api/data');
|
|
587
|
+
expect(req.request.headers.get('Authorization')).toBe('Bearer test-token');
|
|
588
|
+
req.flush({});
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
it('should not add header if no token', () => {
|
|
592
|
+
mockAuthService.getToken = vi.fn().mockReturnValue(null);
|
|
593
|
+
|
|
594
|
+
http.get('/api/data').subscribe();
|
|
595
|
+
|
|
596
|
+
const req = httpMock.expectOne('/api/data');
|
|
597
|
+
expect(req.request.headers.has('Authorization')).toBe(false);
|
|
598
|
+
req.flush({});
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it('should logout on 401 error', () => {
|
|
602
|
+
http.get('/api/data').subscribe({
|
|
603
|
+
error: () => {}
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
const req = httpMock.expectOne('/api/data');
|
|
607
|
+
req.flush('Unauthorized', { status: 401, statusText: 'Unauthorized' });
|
|
608
|
+
|
|
609
|
+
expect(mockAuthService.logout).toHaveBeenCalled();
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
## E2E Testing with Cypress
|
|
615
|
+
|
|
616
|
+
### Setup
|
|
617
|
+
|
|
618
|
+
```typescript
|
|
619
|
+
// cypress/support/commands.ts
|
|
620
|
+
declare global {
|
|
621
|
+
namespace Cypress {
|
|
622
|
+
interface Chainable {
|
|
623
|
+
login(email: string, password: string): Chainable<void>;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
Cypress.Commands.add('login', (email: string, password: string) => {
|
|
629
|
+
cy.visit('/auth/login');
|
|
630
|
+
cy.get('[data-cy=email]').type(email);
|
|
631
|
+
cy.get('[data-cy=password]').type(password);
|
|
632
|
+
cy.get('[data-cy=submit]').click();
|
|
633
|
+
cy.url().should('include', '/dashboard');
|
|
634
|
+
});
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### E2E Test Example
|
|
638
|
+
|
|
639
|
+
```typescript
|
|
640
|
+
// cypress/e2e/users.cy.ts
|
|
641
|
+
describe('Users Feature', () => {
|
|
642
|
+
beforeEach(() => {
|
|
643
|
+
cy.login('admin@test.com', 'password');
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
it('should display users list', () => {
|
|
647
|
+
cy.visit('/users');
|
|
648
|
+
|
|
649
|
+
cy.get('[data-cy=users-list]').should('be.visible');
|
|
650
|
+
cy.get('[data-cy=user-card]').should('have.length.greaterThan', 0);
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
it('should create new user', () => {
|
|
654
|
+
cy.visit('/users');
|
|
655
|
+
cy.get('[data-cy=add-user]').click();
|
|
656
|
+
|
|
657
|
+
cy.get('[data-cy=user-name]').type('New User');
|
|
658
|
+
cy.get('[data-cy=user-email]').type('new@test.com');
|
|
659
|
+
cy.get('[data-cy=save]').click();
|
|
660
|
+
|
|
661
|
+
cy.get('[data-cy=toast]').should('contain', 'User created');
|
|
662
|
+
cy.get('[data-cy=users-list]').should('contain', 'New User');
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
it('should search users', () => {
|
|
666
|
+
cy.visit('/users');
|
|
667
|
+
|
|
668
|
+
cy.get('[data-cy=search]').type('John');
|
|
669
|
+
cy.get('[data-cy=user-card]').should('have.length', 1);
|
|
670
|
+
cy.get('[data-cy=user-card]').should('contain', 'John');
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
## Testing Best Practices
|
|
676
|
+
|
|
677
|
+
### 1. Follow AAA Pattern
|
|
678
|
+
|
|
679
|
+
```typescript
|
|
680
|
+
it('should calculate total', () => {
|
|
681
|
+
// Arrange
|
|
682
|
+
const items = [{ price: 10 }, { price: 20 }];
|
|
683
|
+
|
|
684
|
+
// Act
|
|
685
|
+
const result = calculateTotal(items);
|
|
686
|
+
|
|
687
|
+
// Assert
|
|
688
|
+
expect(result).toBe(30);
|
|
689
|
+
});
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### 2. Use data-cy Attributes
|
|
693
|
+
|
|
694
|
+
```html
|
|
695
|
+
<button data-cy="submit-btn" (click)="onSubmit()">Submit</button>
|
|
696
|
+
<input data-cy="email-input" [(ngModel)]="email" />
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### 3. Test User Behavior, Not Implementation
|
|
700
|
+
|
|
701
|
+
```typescript
|
|
702
|
+
// ❌ Bad - Testing implementation details
|
|
703
|
+
it('should call service method', () => {
|
|
704
|
+
component.loadData();
|
|
705
|
+
expect(service.getData).toHaveBeenCalled();
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
// ✅ Good - Testing user behavior
|
|
709
|
+
it('should display data after loading', async () => {
|
|
710
|
+
fixture.detectChanges();
|
|
711
|
+
await fixture.whenStable();
|
|
712
|
+
|
|
713
|
+
expect(fixture.nativeElement.textContent).toContain('Expected Data');
|
|
714
|
+
});
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### 4. Isolate Tests
|
|
718
|
+
|
|
719
|
+
```typescript
|
|
720
|
+
// Each test should be independent
|
|
721
|
+
beforeEach(() => {
|
|
722
|
+
// Reset state before each test
|
|
723
|
+
store.reset();
|
|
724
|
+
});
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
## Summary
|
|
728
|
+
|
|
729
|
+
| Test Type | Tool | Coverage |
|
|
730
|
+
|-----------|------|----------|
|
|
731
|
+
| Unit | Vitest/Jest | 70% |
|
|
732
|
+
| Integration | TestBed | 20% |
|
|
733
|
+
| E2E | Cypress | 10% |
|
|
734
|
+
|
|
735
|
+
Testing priorities:
|
|
736
|
+
1. Critical business logic
|
|
737
|
+
2. User interactions
|
|
738
|
+
3. Edge cases and error handling
|
|
739
|
+
4. Integration points
|