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.2 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import { pluginRepositoryPageUrl } from './plugin-repository-link'

describe('pluginRepositoryPageUrl', () => {
  it('builds the repository page from the https or ssh install URL', () => {
    expect(pluginRepositoryPageUrl('https://github.com/Acme/Gleam.git')).toBe(
      'https://github.com/acme/gleam'
    )
    expect(pluginRepositoryPageUrl('[email protected]:acme/tools/notes.git')).toBe(
      'https://gitlab.com/acme/tools/notes'
    )
  })

  it('drops credentials, ports, queries and fragments from the URL it was given', () => {
    expect(pluginRepositoryPageUrl('https://user:[email protected]:443/acme/gleam?x=1#y')).toBe(
      'https://github.com/acme/gleam'
    )
  })

  it('refuses other hosts, schemes and odd path segments', () => {
    for (const url of [
      'https://evil.example/acme/gleam',
      'https://github.com.evil.example/acme/gleam',
      'javascript:alert(1)//github.com/acme/gleam',
      'data:text/html,<a>',
      'http://github.com/acme/gleam',
      'https://github.com/acme/%2e%2e',
      'https://github.com/acme'
    ]) {
      expect(pluginRepositoryPageUrl(url)).toBeNull()
    }
  })
})