feat: Screwdriver v1.0.0
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { translateCommand, getAllCommands } from '../src/utils/command-translator.js'
|
||||
|
||||
describe('command-translator', () => {
|
||||
it('translates simple commands', () => {
|
||||
const r = translateCommand('list files')
|
||||
expect(r.success).toBe(true)
|
||||
expect(r.command).toBe('ls -la')
|
||||
})
|
||||
|
||||
it('translates git commands', () => {
|
||||
const r = translateCommand('git status')
|
||||
expect(r.success).toBe(true)
|
||||
expect(r.command).toBe('git status')
|
||||
})
|
||||
|
||||
it('marks dangerous commands', () => {
|
||||
const r = translateCommand('remove directory')
|
||||
expect(r.success).toBe(true)
|
||||
expect(r.dangerous).toBe(true)
|
||||
})
|
||||
|
||||
it('handles unknown input gracefully', () => {
|
||||
const r = translateCommand('xyz')
|
||||
expect(r.success).toBe(false)
|
||||
})
|
||||
|
||||
it('handles empty input', () => {
|
||||
const r = translateCommand('')
|
||||
expect(r.success).toBe(false)
|
||||
expect(r.error).toBe('Empty input')
|
||||
})
|
||||
|
||||
it('has a command catalog', () => {
|
||||
const cmds = getAllCommands()
|
||||
expect(cmds.length).toBeGreaterThan(20)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user