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.

1.0 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import { encodeMobileSelection, parseMobileSelection } from './mobileSelection';

describe('mobile skill selection param', () => {
  it('round-trips a selection, including identifiers that contain a colon', () => {
    const selection = { identifier: 'lobehub:web-search', type: 'builtin' as const };

    expect(parseMobileSelection(encodeMobileSelection(selection))).toEqual(selection);
  });

  it('shows the list for a missing or malformed value', () => {
    expect(parseMobileSelection(null)).toBeUndefined();
    expect(parseMobileSelection('builtin')).toBeUndefined();
    expect(parseMobileSelection('unknown:web-search')).toBeUndefined();
    expect(parseMobileSelection('builtin:')).toBeUndefined();
  });
});

describe('skill detail links', () => {
  it.each(['agent-skill', 'builtin-skill'] as const)('round-trips %s selections', (type) => {
    const selection = { identifier: 'skill:with-colon', type };
    expect(parseMobileSelection(encodeMobileSelection(selection))).toEqual(selection);
  });
});