Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

517 B
Raw Blame
import { describe, expect, it } from 'vitest';

import { parseMessageIdFromHash } from './useMessageDeepLink';

describe('parseMessageIdFromHash', () => {
  it('parses and decodes a message id', () => {
    expect(parseMessageIdFromHash('#msg_%E4%B8%AD')).toBe('msg_中');
  });

  it('returns undefined for an empty hash', () => {
    expect(parseMessageIdFromHash('')).toBeUndefined();
  });

  it('keeps a malformed encoded id usable', () => {
    expect(parseMessageIdFromHash('#msg_%')).toBe('msg_%');
  });
});