feat: introduce Jest testing framework and decouple Product logic
- Added Jest infrastructure (deps, config, global mocks) - Introduced ISpreadsheetService with GAS and Mock implementations - Refactored Product.ts to use dependency injection - Added unit tests for Product class - Updated documentation (README, SETUP, ARCHITECTURE) to reflect testing and init scripts
This commit is contained in:
@ -86,3 +86,14 @@ A dedicated side panel provides visibility into the background queue system.
|
||||
- Displays pending edits with timestamps.
|
||||
- Provides controls to globally enable/disable processing.
|
||||
- Allows manual intervention (delete/push) for individual items.
|
||||
|
||||
### 6. Service Layer & Testing
|
||||
|
||||
To enable unit testing without Google Apps Script dependencies, the project uses a Service pattern with Dependency Injection.
|
||||
|
||||
- **`ISpreadsheetService`**: Interface for all sheet interactions.
|
||||
- **`GASSpreadsheetService`**: Production implementation wrapping `SpreadsheetApp`.
|
||||
- **`MockSpreadsheetService`**: In-memory implementation for tests.
|
||||
|
||||
Classes (like `Product`) should accept an `ISpreadsheetService` in their constructor. This allows providing the Mock service during tests to verify logic without touching real Google Sheets.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user