mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-16 21:53:07 +00:00
* Changes from fix/memory-and-context-mobile-friendly * fix: Improve file extension detection and add path traversal protection * refactor: Extract file extension utilities and add path traversal guards Code review improvements: - Extract isMarkdownFilename and isImageFilename to shared image-utils.ts - Remove duplicated code from context-view.tsx and memory-view.tsx - Add path traversal guard for context fixture utilities (matching memory) - Add 7 new tests for context fixture path traversal protection - Total 61 tests pass Addresses code review feedback from PR #813 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: Add e2e tests for profiles crud and board background persistence * Update apps/ui/playwright.config.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Add robust test navigation handling and file filtering * fix: Format NODE_OPTIONS configuration on single line * test: Update profiles and board background persistence tests * test: Replace iPhone 13 Pro with Pixel 5 for mobile test consistency --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
89 lines
2.2 KiB
JavaScript
89 lines
2.2 KiB
JavaScript
/**
|
|
* Test Feature Unit Tests
|
|
*
|
|
* Simple tests to verify the test feature implementation
|
|
*/
|
|
|
|
const TestFeature = require('./test-feature');
|
|
|
|
function runTests() {
|
|
let passed = 0;
|
|
let failed = 0;
|
|
|
|
console.log('Running Test Feature Tests...\n');
|
|
|
|
// Test 1: Feature creation
|
|
try {
|
|
const feature = new TestFeature('Test Feature');
|
|
if (feature.name === 'Test Feature' && feature.status === 'running') {
|
|
console.log('✓ Test 1: Feature creation - PASSED');
|
|
passed++;
|
|
} else {
|
|
console.log('✗ Test 1: Feature creation - FAILED');
|
|
failed++;
|
|
}
|
|
} catch (error) {
|
|
console.log('✗ Test 1: Feature creation - FAILED:', error.message);
|
|
failed++;
|
|
}
|
|
|
|
// Test 2: Feature execution
|
|
try {
|
|
const feature = new TestFeature();
|
|
const result = feature.execute();
|
|
if (result.success === true && feature.status === 'completed') {
|
|
console.log('✓ Test 2: Feature execution - PASSED');
|
|
passed++;
|
|
} else {
|
|
console.log('✗ Test 2: Feature execution - FAILED');
|
|
failed++;
|
|
}
|
|
} catch (error) {
|
|
console.log('✗ Test 2: Feature execution - FAILED:', error.message);
|
|
failed++;
|
|
}
|
|
|
|
// Test 3: Get status
|
|
try {
|
|
const feature = new TestFeature();
|
|
const status = feature.getStatus();
|
|
if (status === 'running') {
|
|
console.log('✓ Test 3: Get status - PASSED');
|
|
passed++;
|
|
} else {
|
|
console.log('✗ Test 3: Get status - FAILED');
|
|
failed++;
|
|
}
|
|
} catch (error) {
|
|
console.log('✗ Test 3: Get status - FAILED:', error.message);
|
|
failed++;
|
|
}
|
|
|
|
// Test 4: Get info
|
|
try {
|
|
const feature = new TestFeature('My Test Feature');
|
|
const info = feature.getInfo();
|
|
if (info.name === 'My Test Feature' && info.status === 'running' && info.createdAt) {
|
|
console.log('✓ Test 4: Get info - PASSED');
|
|
passed++;
|
|
} else {
|
|
console.log('✗ Test 4: Get info - FAILED');
|
|
failed++;
|
|
}
|
|
} catch (error) {
|
|
console.log('✗ Test 4: Get info - FAILED:', error.message);
|
|
failed++;
|
|
}
|
|
|
|
console.log(`\nTest Results: ${passed} passed, ${failed} failed`);
|
|
return failed === 0;
|
|
}
|
|
|
|
// Run tests
|
|
if (require.main === module) {
|
|
const success = runTests();
|
|
process.exit(success ? 0 : 1);
|
|
}
|
|
|
|
module.exports = { runTests };
|