Skip to content

Commit 1dcbd01

Browse files
committed
fix(parser): Fix get device in getRebootCommand.
1 parent 5b02ed5 commit 1dcbd01

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ const parseCommand = data => {
107107

108108
const getRebootCommand = data => {
109109
let command = null;
110-
if (/TZ-AVL(05|08|201)/.test(data.device)) {
110+
if (data.device === 'tz') {
111111
command = tz.getRebootCommand(data.password || '000000');
112-
} else if (/MVT380/.test(data.device)) {
112+
} else if (data.device === 'meitrack') {
113113
command = meitrack.getRebootCommand(data.imei);
114114
}
115115
return command;

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('tracking-parser', () => {
183183
it('should return TZ raw command reboot', () => {
184184
const data = {
185185
password: 897463,
186-
device: 'TZ-AVL05'
186+
device: 'tz'
187187
};
188188
const raw = tracking.getRebootCommand(data);
189189
expect(raw).to.eql('*897463,991#');
@@ -192,7 +192,7 @@ describe('tracking-parser', () => {
192192
it('should return Meitrack raw command reboot', () => {
193193
const data = {
194194
imei: 353358017784062,
195-
device: 'MVT380'
195+
device: 'meitrack'
196196
};
197197
const raw = tracking.getRebootCommand(data);
198198
expect(raw).to.match(/^@@([\x41-\x7A])(\d{1,3}),353358017784062,F02\*([0-9A-F]{2})\r\n$/);

0 commit comments

Comments
 (0)