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.

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

import { normalizeInterestsForStorage, resolveInterestAreaKey } from './interests';

describe('interests', () => {
  it('resolves canonical keys only', () => {
    expect(resolveInterestAreaKey('coding')).toBe('coding');
    expect(resolveInterestAreaKey(' coding ')).toBe('coding');
    expect(resolveInterestAreaKey('ηΌ–η¨‹δΈŽεΌ€ε‘')).toBeUndefined();
    expect(resolveInterestAreaKey('interests.area.personal')).toBeUndefined();
  });

  it('dedupes predefined keys while preserving freeform values', () => {
    expect(normalizeInterestsForStorage([' coding ', 'ι‡‘θž', 'coding', ' ι‡‘θž '])).toEqual([
      'coding',
      'ι‡‘θž',
    ]);
  });
});