- Add multi-signer contract creation with staff/customer selection
- Add signer-specific signing URLs (/sign/s/{token})
- Add sequential and parallel signing modes
- Fix can_sign check in frontend (use top-level response field)
- Fix required field validation to work for all template types
- Fix PDF overlay generation for HTML templates with generated PDFs
- Add signature pre-fill support in template field editor
- Add signature remember/re-apply feature during signing
- Update PDFOverlayService to read from contract.original_pdf_path
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Quick Test Guide - useTenantExists Hook
Setup (One-time)
cd /home/poduck/Desktop/smoothschedule2/frontend
./install-test-deps.sh
Then add to package.json:
{
"scripts": {
"test": "vitest",
"test:ui": "vitest --ui",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage"
}
}
Run Tests
# Run all tests (watch mode)
npm run test
# Run once (CI mode)
npm run test:run
# Run with UI
npm run test:ui
# Run with coverage
npm run test:coverage
# Run only useTenantExists tests
npm run test -- useTenantExists
# Run specific test by name
npm run test -- -t "returns exists: true"
Files Created
| File | Location | Purpose |
|---|---|---|
| Test Suite | src/hooks/__tests__/useTenantExists.test.ts |
19 comprehensive tests |
| Vitest Config | vitest.config.ts |
Test runner configuration |
| Test Setup | src/test/setup.ts |
Global test setup |
| Install Script | install-test-deps.sh |
Dependency installation |
Test Coverage
✓ All Required Tests Implemented:
- Returns exists: true when API returns 200
- Returns exists: false when API returns 404
- Returns exists: false when subdomain is null
- Returns exists: false on other API errors
- Shows loading state while fetching
- Caches results (5 minute staleTime)
- Does not make API call when subdomain is null
Plus 12 additional tests for edge cases and error handling.
Expected Output
✓ src/hooks/__tests__/useTenantExists.test.ts (19)
✓ useTenantExists
✓ API Success Cases (2)
✓ API Error Cases (4)
✓ Null Subdomain Cases (3)
✓ Loading States (2)
✓ Caching Behavior (2)
✓ Query Key Behavior (1)
✓ Edge Cases (3)
✓ Query Retry Behavior (2)
Test Files 1 passed (1)
Tests 19 passed (19)
Troubleshooting
| Issue | Solution |
|---|---|
Cannot find module 'vitest' |
Run ./install-test-deps.sh |
beforeAll is not defined |
Check vitest.config.ts has globals: true |
document is not defined |
Ensure environment: 'jsdom' in config |
| Tests timeout | Increase testTimeout in config |
Documentation
- TEST_SUMMARY.md - Complete test suite documentation
- SETUP_TESTING.md - Detailed setup instructions
- TESTING.md - Comprehensive testing guide
- src/hooks/tests/README.md - Hook testing patterns
Next Steps
- ✓ Test files created
- → Install dependencies:
./install-test-deps.sh - → Update package.json scripts
- → Run tests:
npm run test - → Check coverage:
npm run test:coverage
Quick Start:
cd /home/poduck/Desktop/smoothschedule2/frontend
./install-test-deps.sh
# Add scripts to package.json
npm run test