- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
import _validatePhoneNumberLength from './validatePhoneNumberLength.js'
|
|
import metadata from '../metadata.min.json' with { type: 'json' }
|
|
|
|
function validatePhoneNumberLength(...parameters) {
|
|
parameters.push(metadata)
|
|
return _validatePhoneNumberLength.apply(this, parameters)
|
|
}
|
|
|
|
describe('validatePhoneNumberLength', () => {
|
|
it('should detect whether a phone number length is valid', () => {
|
|
// Not a phone number.
|
|
expect(validatePhoneNumberLength('+')).to.equal('NOT_A_NUMBER')
|
|
expect(validatePhoneNumberLength('abcde')).to.equal('NOT_A_NUMBER')
|
|
|
|
// No country supplied for a national number.
|
|
expect(validatePhoneNumberLength('123')).to.equal('INVALID_COUNTRY')
|
|
|
|
// Too short while the number is not considered "viable"
|
|
// by Google's `libphonenumber`.
|
|
expect(validatePhoneNumberLength('2', 'US')).to.equal('TOO_SHORT')
|
|
expect(validatePhoneNumberLength('+1', 'US')).to.equal('TOO_SHORT')
|
|
expect(validatePhoneNumberLength('+12', 'US')).to.equal('TOO_SHORT')
|
|
|
|
// Test national (significant) number length.
|
|
expect(validatePhoneNumberLength('444 1 44', 'TR')).to.equal('TOO_SHORT')
|
|
expect(validatePhoneNumberLength('444 1 444', 'TR')).to.be.undefined
|
|
expect(validatePhoneNumberLength('444 1 4444', 'TR')).to.equal('INVALID_LENGTH')
|
|
expect(validatePhoneNumberLength('444 1 4444444444', 'TR')).to.equal('TOO_LONG')
|
|
})
|
|
}) |