mailparser-wrapper.js
980 Bytes
/* global describe it */
require('should');
const mailParser = require('../lib/mailparser-wrapper');
describe('#mailparser-wrapper', () => {
it('should return correct result', async () => {
const msg = `
From: 6285768307050
From_TOA: 91 international, ISDN/telephone
From_SMSC: 62816124
Sent: 19-11-28 20:24:56
Received: 19-11-28 20:25:10
Subject: USB7
Modem: USB7
IMSI: 510014032469304
Report: no
Alphabet: ISO
Length: 20
25.082178898202.1234
`.trim();
const obj = await mailParser(msg);
obj.headers.get('from').text.should.equal('6285768307050');
obj.headers.get('received').should.equal('19-11-28 20:25:10');
obj.headers.get('subject').should.equal('USB7');
obj.headers.get('modem').should.equal('USB7');
obj.headers.get('imsi').should.equal('510014032469304', 'imsi');
obj.headers.get('sent').should.equal('19-11-28 20:24:56');
obj.text.should.equal('25.082178898202.1234');
});
});