feat: 添加对 Kafka CurrentStatusrestart 值支持,更新 G5 入库逻辑及相关测试

This commit is contained in:
2026-03-18 09:47:33 +08:00
parent 1329eca99e
commit 381080fee0
9 changed files with 97 additions and 16 deletions

View File

@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest';
import { mapCurrentStatusToG5Code } from '../src/db/g5DatabaseManager.js';
describe('G5 current_status mapping', () => {
it('maps on/off/restart to numeric codes', () => {
expect(mapCurrentStatusToG5Code('on')).toBe(1);
expect(mapCurrentStatusToG5Code('off')).toBe(2);
expect(mapCurrentStatusToG5Code('restart')).toBe(3);
});
it('returns 0 for unknown values', () => {
expect(mapCurrentStatusToG5Code('idle')).toBe(0);
expect(mapCurrentStatusToG5Code(null)).toBe(0);
});
});