A bundle of tools for the FullWhere platform
npm install @fullwhere/shared-toolsA bundle of tools for the FullWhere platform
``bash`
npm install
`bashBuild the project
npm run build
Testing
This project uses Jest for testing with comprehensive coverage of the FormSubmissionValidator class.
$3
- FormSubmissionValidator: 95.83% statement coverage, 87.75% branch coverage
- Constants: 100% coverage
- Types: 100% coverage
- Exceptions: 92.85% coverage
$3
-
src/form-submission-validator/__tests__/simple.test.ts - Basic validation tests without dependencies (27 tests, all passing)
- src/form-submission-validator/__tests__/FormSubmissionValidator.test.ts - Comprehensive validation tests with dependencies
- src/form-submission-validator/__tests__/integration.test.ts - Complex integration scenarios$3
The tests cover all validation exceptions:
-
NPSOutOfRangeException - NPS value out of range (0-10)
- CSATOutOfRangeException - CSAT value out of range (1-5)
- NumberValueException - Non-numeric values for numeric fields
- DateValidationException - Invalid date strings
- EmailValidationException - Invalid email addresses
- PhoneNumberValidationException - Invalid phone numbers
- FileNameCountException - No files submitted for file fields
- FileNameValidationException - Non-existent files referenced
- DuplicateFileNameException - Duplicate file names
- DuplicateFieldsException - Duplicate field submissions
- ExtraFieldsException - Fields not in form definition
- MissingFieldsException - Required fields not submitted
- FieldNotFoundException - Field not found in form
- InterDependentFieldNotFoundException - Dependent field missing
- AllDependentFieldException - AND dependencies not met
- SomeDependentFieldException - OR dependencies not met
- ValueValidationException - Invalid values for choice fields
- ValueCountException` - Wrong number of valuesA comprehensive form validation library that supports:
- Multiple field types (NPS, CSAT, Date, Email, Phone, Files, Text, Dropdown, Checkbox, etc.)
- Field dependencies with AND/OR logic
- Comparison operators (equals, not equals, greater than, less than, etc.)
- File validation with duplicate detection
- Custom value support
- Comprehensive error reporting
A serializer for Sift entity matching.
ISC