Blame view
test/modems.js
1.58 KB
c0741a574
|
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 |
"use strict"; /* global describe it */ const should = require('should'); const modems = require('../lib/modems'); describe('#modems', function() { describe('#getModemUrl', function() { const modemsConfig = { SMS0: { url: "http://localhost:8888/" } } it('should return correct url', function() { modems.getModemUrl('SMS0', modemsConfig).should.equal('http://localhost:8888/'); }) it ('should handle missing modems', function() { should.not.exists(modems.getModemUrl('SMS0', null)); should.not.exists(modems.getModemUrl('SMS0', {})); should.not.exists(modems.getModemUrl('SMS1', modemsConfig)); }) }) describe('#removeSuffixFromNumber', function() { const config = { number_suffix: '@phonenumber' } it('should return correct number', function() { modems.removeSuffixFromNumber('08181234@phonenumber', config).should.equal('08181234'); }) it ('should return correct number without suffix in the number', function() { modems.removeSuffixFromNumber('08181234', config).should.equal('08181234'); }) it ('should return correct number without suffix in config', function() { modems.removeSuffixFromNumber('08181234', null).should.equal('08181234'); modems.removeSuffixFromNumber('08181234', {}).should.equal('08181234'); modems.removeSuffixFromNumber('08181234@phonenumber', {}).should.equal('08181234'); }) }) }) |