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:
Ben Miller
2025-12-25 03:59:23 -07:00
parent 3c6130778e
commit 9bc55f3a06
3 changed files with 30 additions and 11 deletions

View File

@ -2,23 +2,24 @@
## Local Development Environment
1. **Install Node.js**
This project uses `fnm` to manage Node versions.
1. **Environment Initialization**
Run the provided PowerShell script to automatically install:
- `fnm` (Fast Node Manager) via Winget
- Node.js (v22)
- Global dependencies (`@google/clasp`)
- Project dependencies (`npm install`)
```powershell
# Install fnm (if not installed)
winget install Schniz.fnm
# Configure environment
fnm env --use-on-cd | Out-String | Invoke-Expression
# Install Node version
fnm use --install-if-missing 22
.\init.ps1
```
2. **Install Dependencies**
2. **Verify Installation**
Run tests to confirm the environment is correctly configured.
```bash
npm install
npm install -g @google/clasp
npm test
```
3. **Clasp Login**
Authenticate with Google to allow pushing code.