const fs = require('fs')
const path = require('path')
const remainingFiles = [
'alert-dialog',
'aspect-ratio',
'avatar',
'bottom-navigation',
'carousel',
'chart',
'chip',
'collapsible',
'dialog',
'dropdown-menu',
'fab',
'form',
'label',
'pagination',
'popover',
'resizable',
'sheet',
'sidebar',
'skeleton',
'sonner',
'table',
'textarea',
'toggle-group',
'toggle',
'tooltip',
'top-app-bar',
]
function createBasicTest(componentName) {
const pascalName = componentName
.split('-')
.map(part => part.charAt(0).toUpperCase() + part.slice(1))
.join('')
return `import React from 'react'
import { render } from '@testing-library/react'
describe('${pascalName} Component', () => {
it('renders without crashing', () => {
const { container } = render(
${pascalName}
)
expect(container).toBeInTheDocument()
})
it('has correct structure', () => {
const { getByText } = render(${pascalName}
)
expect(getByText('${pascalName}')).toBeInTheDocument()
})
it('supports custom classes', () => {
const { container } = render(${pascalName}
)
expect(container.firstChild).toHaveClass('custom-class')
})
})
`
}
const uiDir = '/Users/rmac/Documents/GitHub/snippet-pastebin/src/components/ui'
let created = 0
remainingFiles.forEach(filename => {
const testPath = path.join(uiDir, `${filename}.test.tsx`)
if (!fs.existsSync(testPath)) {
const testContent = createBasicTest(filename)
try {
fs.writeFileSync(testPath, testContent)
created++
console.log(`ā Created test for ${filename}.test.tsx`)
} catch (error) {
console.error(`ā Failed to create test for ${filename}:`, error.message)
}
}
})
console.log(`\nā
Created ${created} additional tests`)