import { parseSenderPrefix } from '../../../../../src/modules/netaclaw/runtime/weixin_db/sender_parser.js';

describe('parseSenderPrefix', () => {
  it('parses "wxid_alice:\\n..." prefix', () => {
    const r = parseSenderPrefix('wxid_alice:\n你好');
    expect(r).toEqual({ senderWxid: 'wxid_alice', body: '你好' });
  });

  it('returns null when no colon-newline', () => {
    expect(parseSenderPrefix('系统消息')).toBeNull();
  });

  it('returns null when prefix not starting with wxid_', () => {
    expect(parseSenderPrefix('alice:\n你好')).toBeNull();
  });

  it('returns null when prefix is empty (colon at index 0)', () => {
    expect(parseSenderPrefix(':\nfoo')).toBeNull();
  });
});
