'use strict'; /* global describe it */ global.KOMODO_SDK_NO_LOG_ON_COREAPI = true; const should = require('should'); const prefixes = require('../lib/prefixes'); describe('#prefixes', () => { describe('#lookup', () => { it('should return correct prefix', async () => { const lookupResult = await prefixes.lookup('08180000000'); lookupResult.should.equal('XL'); }); it('should handle unknown prefix', async () => { should.not.exist(await prefixes.lookup()); should.not.exist(await prefixes.lookup('')); should.not.exist(await prefixes.lookup('9')); }); it('should handle cache result', async () => { const lookupResult = await prefixes.lookup('08180000000'); await prefixes.lookup('08180000000'); await prefixes.lookup('08180000000'); await prefixes.lookup('08180000000'); await prefixes.lookup('08180000000'); await prefixes.lookup('08180000000'); lookupResult.should.equal('XL'); }); }); });