diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 0c4bf5feb9..e0b71b9b24 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -37,6 +37,8 @@ Core directives for maintaining code quality and consistency in the Bitwarden iO 1. Follow existing code style in surrounding files 2. Write tests alongside implementation + 1. Prefer using Sourcery with the `AutoMockable` attribute for creating mocks. + 2. If a manual mock implementation is needed (not using Sourcery), place it in a `Mocks` folder within the appropriate framework directory, as our Xcodegen configuration will automatically include it in the correct test target. 3. Add DocC to everything except protocol implementations and mocks 4. Validate against architecture guidelines diff --git a/.claude/skills/reviewing-changes/SKILL.md b/.claude/skills/reviewing-changes/SKILL.md index 30c2a56fb0..2707fe2079 100644 --- a/.claude/skills/reviewing-changes/SKILL.md +++ b/.claude/skills/reviewing-changes/SKILL.md @@ -36,6 +36,7 @@ Systematically check each area against Bitwarden standards documented in `CLAUDE - Unit tests for business logic and utility functions - Snapshot/View inspector tests for user-facing features when applicable - Test coverage for edge cases and error scenarios + - Mocks either rely on Sourcery's `AutoMockable` annotation or are in a `Mocks` folder. 5. **Security**: Given Bitwarden's security-focused nature - Proper handling of sensitive data diff --git a/Docs/Architecture.md b/Docs/Architecture.md index b2f3896e09..9a691e7462 100644 --- a/Docs/Architecture.md +++ b/Docs/Architecture.md @@ -55,11 +55,11 @@ The iOS repository contains two main apps: Bitwarden Password Manager and Bitwar - `BitwardenWatchShared`: Models and encoding/decoding logic for communicating between the iOS and watchOS apps. - `Networking`: A local Swift package that implements the app's networking layer on top of `URLSession`. -### Test Helpers +### Test Helper Targets - `GlobalTestHelpers`: Shared functionality between the app's test targets. -- `BitwardenKitMocks`: Mock implementations for BitwardenKit components. -- `AuthenticatorBridgeKitMocks`: Mock implementations for AuthenticatorBridgeKit components. +- `BitwardenKitMocks`: Mock implementations for BitwardenKit components. Files placed in a `Mocks` folder in `BitwardenKit` will be automatically included in this target. +- `AuthenticatorBridgeKitMocks`: Mock implementations for AuthenticatorBridgeKit components. Files placed in a `Mocks` folder in `AuthenticatorBridgeKit` will be automatically included in this target. - `TestHelpers`: Additional test utilities and helpers. - `ViewInspectorTestHelpers`: ViewInspector-specific test helpers for UI testing.