@t7/utils
Version:
Utility methods for T7 components.
30 lines (23 loc) • 670 B
JavaScript
// Dependencies.
import { formatSSN } from './'
// Describe test.
describe('formatSSN', () => {
// ===========================
// Test for "existing" values.
// ===========================
it('handles "existing" values', () => {
expect(formatSSN('333224444'))
.toBe('333-22-4444')
expect(formatSSN('3-3-3-2-2-4-4-4-4'))
.toBe('333-22-4444')
})
// =======================================
// Test for `null` and `undefined` values.
// =======================================
it('handles `null` and `undefined` values', () => {
expect(formatSSN(null))
.toBe('')
expect(formatSSN(undefined))
.toBe('')
})
})