15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import extractCountryCallingCode from './extractCountryCallingCode.js'
import metadata from '../../metadata.min.json' assert { type: 'json' }
 
describe('extractCountryCallingCode', () => {
    it('should extract country calling code from a number', () => {
        extractCountryCallingCode('+78005553535', null, null, metadata).should.deep.equal({
            countryCallingCodeSource: 'FROM_NUMBER_WITH_PLUS_SIGN',
            countryCallingCode: '7',
            number: '8005553535'
        })
 
        extractCountryCallingCode('+7800', null, null, metadata).should.deep.equal({
            countryCallingCodeSource: 'FROM_NUMBER_WITH_PLUS_SIGN',
            countryCallingCode: '7',
            number: '800'
        })
 
        extractCountryCallingCode('', null, null, metadata).should.deep.equal({})
    })
})