Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license
This commit is contained in:
commit
03634b1ca3
11340 files changed
+3442369
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { displayPath, normalizeDisplayPath, pathLeaf } from './display-path'
|
||||
|
||||
describe('displayPath', () => {
|
||||
it('collapses a macOS home prefix to ~', () => {
|
||||
expect(displayPath('/Users/brooklyn/www/hermes-agent')).toBe('~/www/hermes-agent')
|
||||
expect(displayPath('/Users/brooklyn')).toBe('~')
|
||||
})
|
||||
|
||||
it('collapses a Linux home prefix to ~', () => {
|
||||
expect(displayPath('/home/alice/src/app')).toBe('~/src/app')
|
||||
})
|
||||
|
||||
it('collapses a Windows user profile to ~', () => {
|
||||
expect(displayPath('C:\\Users\\brooklyn\\src')).toBe('~/src')
|
||||
expect(displayPath('C:/Users/brooklyn')).toBe('~')
|
||||
})
|
||||
|
||||
it('honours an explicit home override', () => {
|
||||
expect(displayPath('/opt/work/repo', { home: '/opt/work' })).toBe('~/repo')
|
||||
expect(displayPath('/elsewhere/repo', { home: '/opt/work' })).toBe('/elsewhere/repo')
|
||||
})
|
||||
|
||||
it('leaves non-home absolute paths alone', () => {
|
||||
expect(displayPath('/var/log/system.log')).toBe('/var/log/system.log')
|
||||
expect(displayPath('/Users')).toBe('/Users')
|
||||
})
|
||||
|
||||
it('normalizes separators and trailing slashes', () => {
|
||||
expect(normalizeDisplayPath('C:\\Users\\me\\src\\')).toBe('C:/Users/me/src')
|
||||
expect(displayPath('/Users/me/src/')).toBe('~/src')
|
||||
})
|
||||
|
||||
it('keeps an already-tildified path', () => {
|
||||
expect(displayPath('~/www/app')).toBe('~/www/app')
|
||||
expect(displayPath('~')).toBe('~')
|
||||
})
|
||||
})
|
||||
|
||||
describe('pathLeaf', () => {
|
||||
it('returns the last segment', () => {
|
||||
expect(pathLeaf('/Users/me/www/hermes-agent')).toBe('hermes-agent')
|
||||
expect(pathLeaf('~/www/hermes-agent')).toBe('hermes-agent')
|
||||
expect(pathLeaf('/')).toBe('/')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user