This project uses Bun's built-in test runner (bun:test) for unit tests.
# Run all tests
bun run test
# Run tests in watch mode
bun run test:watch
# Run tests with coverage
bun run test:coverageThe tests cover critical utility functions:
- src/utils/messageContentExtractor.ts - Message parsing utilities (100% coverage)
- src/utils/simpleValidators.ts - Input validation (100% coverage)
- src/config/env.ts - Environment configuration utilities (60% coverage)
- Functions Tested: 15+ core utility functions
- Test Cases: 71 comprehensive test cases
- Line Coverage: ~715 lines out of ~24,752 total (~29%)
getMessageText()- Extract text from Telegram messagesisCommand()- Detect command messagesgetCommand()- Parse command namesgetCommandArgs()- Parse command argumentshasTextContent()- Check for text contentgetMessageTypeInfo()- Message type analysis
SimpleInputValidator.validateSummary()- Ticket summary validationSimpleInputValidator.getStats()- Text statistics
getEnvVar()- Environment variable accessisProduction()/isDevelopment()- Environment detectiongetDefaultTicketPriority()- Priority configurationgetCompanyName()- Company name handlinggetConfiguredBotUsername()- Bot username validation
src/
βββ __tests__/
β βββ messageContentExtractor.test.ts
β βββ simpleValidators.test.ts
β βββ env.test.ts
βββ [source files...]
# Install dependencies
bun install
# Run tests
bun testThese tests focus on:
- Pure functions - No external dependencies
- Business logic - Core utility functions
- Edge cases - Comprehensive input validation
- Error handling - Proper error scenarios
The tests provide a solid foundation for the project's testing infrastructure and cover the most critical utility functions that power the Telegram bot's core functionality.