-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(usephoneinput): increased use phone input coverage (#86)
- Loading branch information
1 parent
8f6ea12
commit f967bbd
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/phone-input/src/helpers/formatWithFixedCountry/formatWithFixedCountry.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import { formatWithFixedCountry } from './formatWithFixedCountry' | ||
|
||
describe('formatWithFixedCountry', () => { | ||
it('Should return empty string when phone value is invalid', () => { | ||
expect(formatWithFixedCountry('', 'US')).toBe('') | ||
}) | ||
|
||
it('Should leave as-is when the value is already has valid country code.', () => { | ||
expect(formatWithFixedCountry('+123456', 'US')).toBe('+123456') | ||
}) | ||
|
||
it('Should format to the correct country code.', () => { | ||
expect(formatWithFixedCountry('+123456', 'VN')).toBe('+84123456') | ||
expect(formatWithFixedCountry('0123456', 'VN')).toBe('+84123456') | ||
expect(formatWithFixedCountry('123456', 'VN')).toBe('+84123456') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters