Tests are now set up and working! Just run:
npm testIf you're setting up the project for the first time:
# Install all dependencies (including Jest)
npm install
# Run tests to verify everything works
npm testIf you encounter integrity check errors with the obsidian package:
# Clear npm cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm installThis should resolve the issue. The npm cache fix worked for us!
test/frontmatter-exists.test.ts- Comprehensive unit tests for the new featuretest/mocks/obsidian.ts- Mock Obsidian APItest/setup.ts- Jest setup filejest.config.js- Jest configuration
Once Jest is installed:
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverageThe frontmatter-exists.test.ts file tests:
- ✅ Non-empty strings
- ❌ Empty strings
- ❌ Whitespace-only strings
- ✅ Non-empty arrays
- ❌ Empty arrays
- ✅ Boolean true
- ✅ Boolean false
- ✅ Number zero
- ❌ Null values
- ❌ Missing/undefined fields
- ❌ Missing frontmatter
- ✅ Nested fields