feat: Screwdriver v1.0.0

This commit is contained in:
Bun Bun
2026-06-16 12:30:22 +00:00
commit e7555e6f41
28 changed files with 4893 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
import { describe, it, expect } from 'vitest'
import { transformText, TRANSFORM_OPTIONS } from '../src/utils/text-transformer.js'
describe('text-transformer', () => {
it('converts to uppercase', () => {
const r = transformText('hello world', 'uppercase')
expect(r.success).toBe(true)
expect(r.result).toBe('HELLO WORLD')
})
it('converts to camelCase', () => {
const r = transformText('hello world', 'camelcase')
expect(r.success).toBe(true)
expect(r.result).toBe('helloWorld')
})
it('base64 encodes', () => {
const r = transformText('hello', 'base64encode')
expect(r.success).toBe(true)
expect(r.result).toBe('aGVsbG8=')
})
it('base64 decodes', () => {
const r = transformText('aGVsbG8=', 'base64decode')
expect(r.success).toBe(true)
expect(r.result).toBe('hello')
})
it('formats JSON', () => {
const r = transformText('{"a":1}', 'jsonpretty')
expect(r.success).toBe(true)
expect(r.result).toContain('"a": 1')
})
it('minifies JSON', () => {
const r = transformText('{\n "a": 1\n}', 'jsoncompact')
expect(r.success).toBe(true)
expect(r.result).toBe('{"a":1}')
})
it('sorts lines', () => {
const r = transformText('c\nb\na', 'sortlines')
expect(r.success).toBe(true)
expect(r.result).toBe('a\nb\nc')
})
it('has transform options', () => {
expect(TRANSFORM_OPTIONS.length).toBeGreaterThan(10)
})
it('handles invalid JSON', () => {
const r = transformText('not json', 'jsonpretty')
expect(r.success).toBe(false)
expect(r.error).toBeDefined()
})
})