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.1 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import { hasBinaryFileExtension } from './binary-file-extensions'

describe('hasBinaryFileExtension', () => {
  it('matches known binary extensions case-insensitively', () => {
    expect(hasBinaryFileExtension('docs/Shot.PNG')).toBe(true)
    expect(hasBinaryFileExtension('vendor/lib.tar.gz')).toBe(true)
    expect(hasBinaryFileExtension('C:\\assets\\theme.woff2')).toBe(true)
  })

  it('treats svg as text because the diff view renders its source', () => {
    expect(hasBinaryFileExtension('assets/map.svg')).toBe(false)
  })

  it('rejects text files, dotfiles, and extensionless paths', () => {
    expect(hasBinaryFileExtension('src/index.ts')).toBe(false)
    expect(hasBinaryFileExtension('.png')).toBe(false)
    expect(hasBinaryFileExtension('scripts/.png')).toBe(false)
    expect(hasBinaryFileExtension('Makefile')).toBe(false)
    expect(hasBinaryFileExtension(undefined)).toBe(false)
  })

  it('does not match an extension that only appears in a directory name', () => {
    expect(hasBinaryFileExtension('build.zip/manifest')).toBe(false)
  })
})