Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

1.2 KB
Raw Blame
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
import { deepLinkToRoute } from '../src/main/deep-link-manager.js';

describe('Desktop deep links', () => {
  it('maps supported links to existing hash routes', () => {
    expect(deepLinkToRoute('opencreator://new')).toBe('#/');
    expect(deepLinkToRoute('opencreator://tasks')).toBe('#/tasks');
    expect(deepLinkToRoute(
      'opencreator://thread/thread%2F%E4%B8%AD%E6%96%87?runId=run%2F1&approvalId=approval%201'
    )).toBe(
      '#/thread/thread%2F%E4%B8%AD%E6%96%87?runId=run%2F1&approvalId=approval+1'
    );
  });

  it('rejects unknown routes and protocols', () => {
    expect(deepLinkToRoute('https://example.com')).toBeUndefined();
    expect(deepLinkToRoute('opencreator://unknown')).toBeUndefined();
  });

  it('leaves application localization at the system default', () => {
    const mainSource = readFileSync('src/main/main.ts', 'utf8');
    const builderConfig = readFileSync('electron-builder.yml', 'utf8');

    expect(mainSource).not.toMatch(/app\.commandLine\.appendSwitch\(['"]lang['"]/);
    expect(builderConfig).not.toContain('CFBundleDevelopmentRegion:');
    expect(builderConfig).not.toContain('CFBundleLocalizations:');
  });
});