Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

2.0 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import { normalizeTerminalCustomThemes } from './terminal-custom-themes'

describe('terminal custom themes', () => {
  it('normalizes colors and drops invalid theme records', () => {
    const themes = normalizeTerminalCustomThemes([
      {
        id: 'warp:Tokyo Night',
        name: 'Tokyo/Night\\Dark',
        source: 'warp',
        mode: 'dark',
        terminal: {
          background: '1a1b26',
          foreground: '#c0caf5',
          black: '#15161e',
          red: 'not-a-color'
        },
        importedAt: '2026-06-05T00:00:00.000Z',
        sourcePath: '/Users/alice/.warp/themes/tokyo.yaml'
      },
      {
        id: 'bad',
        name: 'Bad',
        source: 'warp',
        terminal: { background: '#000000' }
      }
    ])

    expect(themes).toEqual([
      {
        id: 'warp:tokyo-night',
        name: 'Tokyo Night Dark',
        source: 'warp',
        mode: 'dark',
        terminal: {
          background: '#1a1b26',
          foreground: '#c0caf5',
          black: '#15161e'
        },
        importedAt: '2026-06-05T00:00:00.000Z'
      }
    ])
  })

  it('deduplicates normalized ids with last write winning', () => {
    const themes = normalizeTerminalCustomThemes([
      {
        id: 'warp:dupe',
        name: 'First',
        source: 'warp',
        terminal: { background: '#000000', foreground: '#ffffff', black: '#111111' }
      },
      {
        id: 'warp:dupe',
        name: 'Second',
        source: 'warp',
        terminal: { background: '#000000', foreground: '#ffffff', red: '#ff0000' }
      }
    ])

    expect(themes).toHaveLength(1)
    expect(themes[0]?.name).toBe('Second')
    expect(themes[0]?.terminal.red).toBe('#ff0000')
  })

  it('requires at least one ANSI palette color', () => {
    expect(
      normalizeTerminalCustomThemes([
        {
          id: 'warp:cursor-only',
          name: 'Cursor Only',
          source: 'warp',
          terminal: { background: '#000000', foreground: '#ffffff', cursor: '#ffffff' }
        }
      ])
    ).toEqual([])
  })
})