Blame view
test/modems.js
1.63 KB
c0741a574
|
1 2 3 4 5 |
"use strict"; /* global describe it */ const should = require('should'); |
f43dbc16a
|
6 |
const modemSelect = require('../lib/modemSelect'); |
c0741a574
|
7 |
|
f43dbc16a
|
8 |
describe('#modemSelect', function() { |
c0741a574
|
9 10 11 12 13 14 15 16 17 18 |
describe('#getModemUrl', function() { const modemsConfig = { SMS0: { url: "http://localhost:8888/" } } it('should return correct url', function() { |
f43dbc16a
|
19 |
modemSelect.getModemUrl('SMS0', modemsConfig).should.equal('http://localhost:8888/'); |
c0741a574
|
20 21 22 |
}) it ('should handle missing modems', function() { |
f43dbc16a
|
23 24 25 |
should.not.exists(modemSelect.getModemUrl('SMS0', null)); should.not.exists(modemSelect.getModemUrl('SMS0', {})); should.not.exists(modemSelect.getModemUrl('SMS1', modemsConfig)); |
c0741a574
|
26 27 28 29 30 31 32 33 34 |
}) }) describe('#removeSuffixFromNumber', function() { const config = { number_suffix: '@phonenumber' } it('should return correct number', function() { |
f43dbc16a
|
35 |
modemSelect.removeSuffixFromNumber('08181234@phonenumber', config).should.equal('08181234'); |
c0741a574
|
36 37 38 |
}) it ('should return correct number without suffix in the number', function() { |
f43dbc16a
|
39 |
modemSelect.removeSuffixFromNumber('08181234', config).should.equal('08181234'); |
c0741a574
|
40 41 42 |
}) it ('should return correct number without suffix in config', function() { |
f43dbc16a
|
43 44 45 |
modemSelect.removeSuffixFromNumber('08181234', null).should.equal('08181234'); modemSelect.removeSuffixFromNumber('08181234', {}).should.equal('08181234'); modemSelect.removeSuffixFromNumber('08181234@phonenumber', {}).should.equal('08181234'); |
c0741a574
|
46 47 48 49 |
}) }) }) |