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.

1.3 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import {
  gitUrlPluginPublisher,
  localPluginPublisher,
  withPluginPublisher
} from './plugin-publisher-derivation'

describe('plugin publisher derivation', () => {
  it('names a Git URL after its owner, lowercased', () => {
    expect(gitUrlPluginPublisher('https://github.com/Acme/gleam.git')).toBe('acme')
    expect(gitUrlPluginPublisher('[email protected]:Acme/gleam.git')).toBe('acme')
    expect(gitUrlPluginPublisher('ssh://[email protected]/acme/tools/gleam.git')).toBe('acme')
    expect(gitUrlPluginPublisher('https://gitlab.com/john.doe__x/gleam.git')).toBe('john-doe-x')
  })

  it('names nobody when the URL has no usable owner', () => {
    expect(gitUrlPluginPublisher('ssh://[email protected]/gleam.git')).toBeNull()
    expect(gitUrlPluginPublisher('https://github.com/constructor/gleam.git')).toBeNull()
    expect(gitUrlPluginPublisher('file:///tmp/acme/gleam')).toBeNull()
  })

  it('keeps a folder on its declared publisher while deprecated, else local', () => {
    expect(localPluginPublisher('acme')).toBe('acme')
    expect(localPluginPublisher(undefined)).toBe('local')
  })

  it('overrides whatever publisher the manifest declared', () => {
    expect(withPluginPublisher({ id: 'gleam', publisher: 'brand' }, 'acme')).toEqual({
      id: 'gleam',
      publisher: 'acme'
    })
  })
})