smstools-modem-info.js
1.49 KB
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
/* global describe it */
const should = require('should');
const modemInfo = require('../lib/smstools-modem-info');
describe('#smstool-modem-info', () => {
describe('#getIMSI', () => {
it('should return correct result', async () => {
(await modemInfo.getIMSI('GSM1', 'test/data/regular_run_result_file/<MODEMNAME>')).should.equal('510108325339393');
});
it('should handle missing file', async () => {
should.not.exist(await modemInfo.getIMSI('GSM1', 'test/data/regular_run_result_file/<MODEMNAME>2', 'wrong file'));
should.not.exist(await modemInfo.getIMSI('GSM1', '/dev/null', '/dev/null'));
});
});
describe('#getIMEI', () => {
it('should return correct result', async () => {
(await modemInfo.getIMEI('GSM1', 'test/data/regular_run_result_file/<MODEMNAME>')).should.equal('351047887082374');
});
});
describe('#getCOPS', () => {
it('should return correct result', async () => {
(await modemInfo.getCOPS('GSM1', 'test/data/regular_run_result_file/<MODEMNAME>')).should.equal('0,2,51010');
});
});
describe('#get', () => {
it('should return correct result', async () => {
const { imsi, imei, cops } = await modemInfo.get('GSM1', 'test/data/regular_run_result_file/<MODEMNAME>');
imsi.should.equal('510108325339393');
imei.should.equal('351047887082374');
cops.should.equal('0,2,51010');
});
});
});