WIP: #7354 zone_missing_e2e #1030

Draft
jsegarra wants to merge 191 commits from 7354_zone_missing_e2e into dev
2 changed files with 11 additions and 0 deletions
Showing only changes of commit e2304396d8 - Show all commits

View File

@ -1,4 +1,7 @@
export default function (phone, prefix = 34) {
if (!phone) {
return;
}
if (phone.startsWith('+')) {
return `${phone.slice(1)}`;
}

View File

@ -2,6 +2,14 @@ import { describe, it, expect } from 'vitest';
import parsePhone from 'src/filters/parsePhone';
describe('parsePhone filter', () => {
it('no phone', () => {
const resultado = parsePhone(null, '34');
expect(resultado).toBe(undefined);
});
it('no phone and no prefix', () => {
const resultado = parsePhone(null, null);
expect(resultado).toBe(undefined);
});
it("adds prefix +34 if it doesn't have one", () => {
const resultado = parsePhone('123456789', '34');
expect(resultado).toBe('34123456789');