Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

2.4 KB
Raw Blame
import { describe, expect, it } from 'vitest';
import * as fs from 'node:fs';
import * as path from 'node:path';

const root = path.join(__dirname, '../..');

function read(rel: string) {
  return fs.readFileSync(path.join(root, rel), 'utf8');
}

describe('connectors card surface', () => {
  it('keeps the synced card grid sizing and compact menu styling', () => {
    const css = read('src/renderer/style.css');

    expect(css).toMatch(/\.connectors-grid\s*{[\s\S]*?--connector-card-min:\s*280px;[\s\S]*?grid-template-columns:\s*repeat\(auto-fill,\s*minmax\(min\(100%,\s*max\(var\(--connector-card-min\),\s*calc\(\(100% - \(3 \* var\(--connector-grid-gap\)\)\) \/ 4\)\)\),\s*1fr\)\);/);
    expect(css).toMatch(/\.connector-card\s*{[\s\S]*?padding:\s*14px 16px;/);
    expect(css).toMatch(/\.connector-card-menu-btn\s*{[\s\S]*?width:\s*22px;[\s\S]*?height:\s*22px;[\s\S]*?visibility:\s*hidden;/);
    expect(css).toContain('.connector-card:hover .connector-card-menu-btn');
    expect(css).toMatch(/\.connector-card-foot\s*{[\s\S]*?gap:\s*8px;[\s\S]*?min-width:\s*0;/);
    expect(css).toMatch(/\.connector-card-foot \.btn\s*{[\s\S]*?flex:\s*0 0 auto;/);
  });

  it('renders connected cards with Use and keeps enable/disable in the card menu', () => {
    const js = read('src/renderer/modules/connectors.js');

    expect(js).toContain('data-act="use-connector"');
    expect(js).toContain('connector-card-use');
    expect(js).toContain("setChatConnector('new-chat'");
    expect(js).toContain('data-act="toggle-enabled"');
    expect(js).toContain('_clearConnectorCardMenuState');
    expect(js).not.toContain('authorize-sheets');
    expect(js).not.toContain('connectors.google_sheets_authorize_files');
  });

  it('renders the API-key-backed credit connector marker and settings guard', () => {
    const js = read('src/renderer/modules/connectors.js');
    const css = read('src/renderer/style.css');
    const locales = ['en', 'zh', 'ja', 'pt'].map((lang) => read(`src/renderer/locales/${lang}.json`)).join('\n');
    const copyKey = ['connectors.badge.', 'credits', '_required'].join('');

    expect(js).toContain('entry.requires_credits === true');
    expect(js).toContain("window.orkas.invoke('orkasApi.getStatus')");
    expect(js).toContain("window.activateSettingsTab('credentials')");
    expect(css).toContain('.connector-credit-badge');
    expect(locales).toContain(copyKey);
  });
});