Skip to content

Commit f4bcaf1

Browse files
committed
test: add test for pdu creating
1 parent f18fb4a commit f4bcaf1

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/creating.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, expect, test } from 'vitest';
2+
import { Submit } from '../src/index';
3+
4+
describe('Test PDU creation', () => {
5+
test('should correctly create a single-part Submit PDU message', () => {
6+
const submit = new Submit('+1234567890', 'Hello, this is a simple Submit.');
7+
8+
const pduParts = submit.getPartStrings();
9+
expect(pduParts).toHaveLength(1);
10+
11+
expect(pduParts[0]).toBe('0001000A91214365870900001FC8329BFD6681E8E8F41C949E83C2A079BA0D679741D3BAB89DA6BB00');
12+
});
13+
14+
test('should correctly create a multi-part Submit PDU message', () => {
15+
const submit = new Submit(
16+
'+1234567890',
17+
'Hello, this is a long text to reproduce the issue that Adam Smid has provided, I am trying to reproduce this with success. I hope you guys have a good day today, make every day count in your live!'
18+
);
19+
20+
const pduParts = submit.getPartStrings();
21+
expect(pduParts).toHaveLength(2);
22+
23+
expect(pduParts[0]).toBe(
24+
'0041000A91214365870900008D06080403B60201C8329BFD6681E8E8F41C949E83C220F6DB7D06D1CB783A88FE06C9CB70F99B5C1F9741747419949ECFEB65101D1DA68382E4701B346DA7C92074780E82CBDFF634B94C668192A0701B4497E7D3EE3388FE06C9CB70F99B5C1F974174747A0EBAA7E968D0BC3E1E97E77317280942BFE16550FE5D07'
25+
);
26+
expect(pduParts[1]).toBe(
27+
'0041000A91214365870900004706080403B60202A0733D3F07A1C3F632280C3ABFDF6410399C07D1DFE4709E056A87D76550D95E96E741E4701E347ED7DD7450DA0DCABFEB72103B6D2F8700'
28+
);
29+
});
30+
});

0 commit comments

Comments
 (0)