@fullwhere/shared-tools
v1.4.10
Published
A bundle of tools for the FullWhere platform
Readme
Tools
A bundle of tools for the FullWhere platform
Installation
npm installDevelopment
# Build the project
npm run build
# Format code
npm run format
# Lint code
npm run lint
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watchTesting
This project uses Jest for testing with comprehensive coverage of the FormSubmissionValidator class.
Test Coverage
- FormSubmissionValidator: 95.83% statement coverage, 87.75% branch coverage
- Constants: 100% coverage
- Types: 100% coverage
- Exceptions: 92.85% coverage
Test Structure
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 dependenciessrc/form-submission-validator/__tests__/integration.test.ts- Complex integration scenarios
Exception Coverage
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 fieldsDateValidationException- Invalid date stringsEmailValidationException- Invalid email addressesPhoneNumberValidationException- Invalid phone numbersFileNameCountException- No files submitted for file fieldsFileNameValidationException- Non-existent files referencedDuplicateFileNameException- Duplicate file namesDuplicateFieldsException- Duplicate field submissionsExtraFieldsException- Fields not in form definitionMissingFieldsException- Required fields not submittedFieldNotFoundException- Field not found in formInterDependentFieldNotFoundException- Dependent field missingAllDependentFieldException- AND dependencies not metSomeDependentFieldException- OR dependencies not metValueValidationException- Invalid values for choice fieldsValueCountException- Wrong number of values
Available Tools
FormSubmissionValidator
A 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
SiftSerializer
A serializer for Sift entity matching.
License
ISC