-
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.
[Contact des unités de contrôle] Ajout d'un format de numéro (#1537)
## Related Pull Requests & Issues - Resolve #1467 ---- - [ ] Tests E2E (Cypress)
- Loading branch information
Showing
7 changed files
with
95 additions
and
41 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
49 changes: 49 additions & 0 deletions
49
...t/components/ControlUnitDialog/ControlUnitContactList/__tests__/formatPhoneNumber.test.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { describe, expect, it } from '@jest/globals' | ||
|
||
import { formatPhoneNumber } from '../Item' | ||
|
||
describe('Phone Number format', () => { | ||
it('should format international number starting with 00 then 3 by 3', async () => { | ||
// Given | ||
const phoneNumber = '00111222333444' | ||
|
||
// When | ||
const formattedNumber = formatPhoneNumber(phoneNumber) | ||
|
||
// Then | ||
expect(formattedNumber).toEqual('00 111 222 333 444') | ||
}) | ||
|
||
it('should format international french number starting with 00 then 2 by 2', async () => { | ||
// Given | ||
const phoneNumber = '003344556677' | ||
|
||
// When | ||
const formattedNumber = formatPhoneNumber(phoneNumber) | ||
|
||
// Then | ||
expect(formattedNumber).toEqual('00 33 44 55 66 77') | ||
}) | ||
|
||
it('should format french number 2 by 2', async () => { | ||
// Given | ||
const phoneNumber = '0122334455' | ||
|
||
// When | ||
const formattedNumber = formatPhoneNumber(phoneNumber) | ||
|
||
// Then | ||
expect(formattedNumber).toEqual('01 22 33 44 55') | ||
}) | ||
|
||
it('should format other format 3 by 3', async () => { | ||
// Given | ||
const phoneNumber = '+33123456789100' | ||
|
||
// When | ||
const formattedNumber = formatPhoneNumber(phoneNumber) | ||
|
||
// Then | ||
expect(formattedNumber).toEqual('+33 123 456 789 100') | ||
}) | ||
}) |
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
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