📚 Add state management and testing guidelines documentation

Introduced new documentation files for state management and testing guidelines to enhance developer understanding and best practices.

- 📚 **Docs**: Added state management guidelines with local and global state recommendations
- 📚 **Docs**: Created testing guidelines including unit testing requirements and best practices
- 📚 **Docs**: Updated project structure documentation for clarity
This commit is contained in:
Lorenz Hilpert
2025-03-31 11:52:17 +02:00
parent 1cbabd2d7a
commit 3c110efdfa
12 changed files with 619 additions and 368 deletions

View File

@@ -0,0 +1,35 @@
# Testing Guidelines
## Unit Testing Requirements
- Test files should end with `.spec.ts`.
- Use Spectator for Component, Directive and Service tests.
- Use Jest as the test runner.
- Follow the Arrange-Act-Assert (AAA) pattern in tests.
- Mock external dependencies to isolate the unit under test.
## Example Test Structure
```typescript
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest';
import { MyComponent } from './my-component.component';
describe('MyComponent', () => {
let spectator: Spectator<MyComponent>;
const createComponent = createComponentFactory(MyComponent);
beforeEach(() => {
spectator = createComponent();
});
it('should create', () => {
expect(spectator.component).toBeTruthy();
});
it('should handle action correctly', () => {
spectator.setInput('inputProp', 'testValue');
spectator.click('button');
expect(spectator.component.outputProp).toBe('expectedValue');
});
});
```