Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

933 B
Raw Blame
import { describe, expect, it } from 'vitest';
import { xquikCommon } from '../src/lib/common/index';

describe('xquikCommon.utils', () => {
  it('removes empty query values and stringifies primitives', () => {
    expect.assertions(1);

    expect(
      xquikCommon.utils.cleanQueryParams({
        count: 30,
        cursor: undefined,
        includeReplies: false,
        maxId: null,
        q: 'AI',
        sinceTime: '',
      })
    ).toStrictEqual({
      count: '30',
      includeReplies: 'false',
      q: 'AI',
    });
  });

  it('strips an @ prefix from usernames', () => {
    expect.assertions(2);

    expect(xquikCommon.utils.stripAtPrefix('@xquik')).toBe('xquik');
    expect(xquikCommon.utils.stripAtPrefix('xquik')).toBe('xquik');
  });

  it('encodes path segments', () => {
    expect.assertions(1);

    expect(xquikCommon.utils.encodePathPart('hello/world')).toBe(
      'hello%2Fworld'
    );
  });
});