Blame view

test/prefixes.js 1.07 KB
8295b94e7   Adhidarma Hadiwinoto   CORE prefixes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  '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'));
          });
4a1706c99   Adhidarma Hadiwinoto   Prefixes cached
22
23
24
25
26
27
28
29
30
31
  
          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');
          });
8295b94e7   Adhidarma Hadiwinoto   CORE prefixes
32
33
      });
  });