All files mobileNumberGenerators.ts

100% Statements 36/36
100% Branches 0/0
100% Functions 17/17
100% Lines 36/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116                                                1x     3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       3x 3x       1x      
// src/mobileNumberGenerators.ts
// Generator functions for Dutch and European test phone numbers
 
export type PhoneNumberType = 'mobile' | 'landline';
 
export type SupportedCountry =
  | 'Netherlands'
  | 'Germany'
  | 'Belgium'
  | 'France'
  | 'UnitedKingdom'
  | 'Spain'
  | 'Italy'
  | 'Austria'
  | 'Switzerland'
  | 'Sweden'
  | 'Norway'
  | 'Denmark'
  | 'Finland'
  | 'Portugal'
  | 'Ireland'
  | 'Turkey'
  | 'Morocco';
 
export const generateTestMobileNumber: Record<SupportedCountry, () => string> = {
  Netherlands: () => {
    // 06 99xxxxxx (zonder landcode)
    const random = Math.floor(100000 + Math.random() * 900000);
    return `06 99${random.toString().padStart(6, '0')}`;
  },
  Germany: () => {
    // +49 151 99xxxxx (test range)
    const random = Math.floor(10000 + Math.random() * 90000);
    return `+49 151 99${random.toString().padStart(5, '0')}`;
  },
  Belgium: () => {
    // +32 470 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+32 470 99${random.toString().padStart(4, '0')}`;
  },
  France: () => {
    // +33 6 99xxxxxx (test range)
    const random = Math.floor(100000 + Math.random() * 900000);
    return `+33 6 99${random.toString().padStart(6, '0')}`;
  },
  UnitedKingdom: () => {
    // +44 7900 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+44 7900 99${random.toString().padStart(4, '0')}`;
  },
  Spain: () => {
    // +34 699 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+34 699 99${random.toString().padStart(4, '0')}`;
  },
  Italy: () => {
    // +39 399 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+39 399 99${random.toString().padStart(4, '0')}`;
  },
  Austria: () => {
    // +43 699 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+43 699 99${random.toString().padStart(4, '0')}`;
  },
  Switzerland: () => {
    // +41 79 99xxxxxx (test range)
    const random = Math.floor(100000 + Math.random() * 900000);
    return `+41 79 99${random.toString().padStart(6, '0')}`;
  },
  Sweden: () => {
    // +46 79 99xxxxx (test range)
    const random = Math.floor(10000 + Math.random() * 90000);
    return `+46 79 99${random.toString().padStart(5, '0')}`;
  },
  Norway: () => {
    // +47 99 99 99 99 (test range)
    const random = Math.floor(10000000 + Math.random() * 90000000);
    return `+47 99${random.toString().padStart(7, '0')}`;
  },
  Denmark: () => {
    // +45 99 99 99 99 (test range)
    const random = Math.floor(10000000 + Math.random() * 90000000);
    return `+45 99${random.toString().padStart(7, '0')}`;
  },
  Finland: () => {
    // +358 49 9999999 (test range)
    const random = Math.floor(1000000 + Math.random() * 9000000);
    return `+358 49 99${random.toString().padStart(5, '0')}`;
  },
  Portugal: () => {
    // +351 99 9999999 (test range)
    const random = Math.floor(1000000 + Math.random() * 9000000);
    return `+351 99${random.toString().padStart(7, '0')}`;
  },
  Ireland: () => {
    // +353 89 9999999 (test range)
    const random = Math.floor(1000000 + Math.random() * 9000000);
    return `+353 89 99${random.toString().padStart(5, '0')}`;
  },
  Turkey: () => {
    // +90 555 99xxxxxx (test range)
    const random = Math.floor(1000000 + Math.random() * 9000000);
    return `+90 555 99${random.toString().padStart(5, '0')}`;
  },
  Morocco: () => {
    // +212 699 99xxxx (test range)
    const random = Math.floor(1000 + Math.random() * 9000);
    return `+212 699 99${random.toString().padStart(4, '0')}`;
  },
};
 
export const testNumbersGenerator = {
  generateTestMobileNumber,
};