smstools-modem-info.js 1.49 KB
/* 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');
        });
    });
});