feat: 更新 buildRowsFromPayload 函数以根据 is_send 字段条件返回房间状态行,并添加相应的单元测试
This commit is contained in:
@@ -223,7 +223,7 @@ export const buildRowsFromPayload = (rawPayload) => {
|
||||
|
||||
return {
|
||||
registerRows: [registerRow],
|
||||
roomStatusRows: [roomStatusUpdateRow]
|
||||
roomStatusRows: registerRow.is_send === 0 ? [roomStatusUpdateRow] : []
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,13 @@ describe('Register Processor', () => {
|
||||
expect(rows.roomStatusRows[0].hotel_id).toBe(0);
|
||||
});
|
||||
|
||||
it('should skip room_status updates when is_send is not 0', () => {
|
||||
const rows = buildRowsFromPayload({ ...basePayload, is_send: 1 });
|
||||
expect(rows.registerRows).toHaveLength(1);
|
||||
expect(rows.registerRows[0].is_send).toBe(1);
|
||||
expect(rows.roomStatusRows).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should convert udp_raw byte array to base64 text', () => {
|
||||
const rows = buildRowsFromPayload({
|
||||
...basePayload,
|
||||
|
||||
Reference in New Issue
Block a user