-
Notifications
You must be signed in to change notification settings - Fork 12
/
test.js
28 lines (26 loc) · 1.34 KB
/
test.js
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
var ISO8583 = require('./');
var iso = '0800822000000000000004000000000000000516063439749039301';
/*
MTI: 0800
ISO: 08001000001000100000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000004000000000000000516063439749039301
Bitmap: 10000010001000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000
*/
describe('ISO 8583 parser and builder', function() {
it ('should parse an iso message', function(done) {
var iso8583 = new ISO8583();
iso8583.addISO(iso);
iso8583.getMTI().should.equal('0800');
iso8583.getISO().should.equal('08001000001000100000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000004000000000000000516063439749039301');
iso8583.getBitmap().should.equal('10000010001000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000');
done();
});
it ('should build an iso message', function(done) {
var iso8583 = new ISO8583();
iso8583.addMTI('0800');
iso8583.addData(7, '0531203842');
iso8583.addData(11, '286808');
iso8583.addData(70, '301');
iso8583.getISO().should.equal('0800822000000000000004000000000000000531203842286808301');
done();
});
});