forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-loading-fix.cjs
More file actions
59 lines (50 loc) · 2.12 KB
/
test-loading-fix.cjs
File metadata and controls
59 lines (50 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Simple test to verify loading.tsx fixes
const fs = require('fs')
const path = require('path')
const filePath = path.join(__dirname, 'packages/desktop/src/loading.tsx')
const content = fs.readFileSync(filePath, 'utf8')
console.log('Testing Loading Component fixes...\n')
// Test 1: Check for removed unnecessary type assertions
const hasUnnecessaryTypeAssertion = content.includes('new Channel<InitStep>() as any')
if (!hasUnnecessaryTypeAssertion) {
console.log('✅ Unnecessary type assertion removed')
} else {
console.log('❌ Unnecessary type assertion still present')
}
// Test 2: Check for CSS class fix
const hasCorrectCSSClass = content.includes('bg-surface-weak') && !content.includes('bg-surface-weak')
if (hasCorrectCSSClass) {
console.log('✅ CSS class typo fixed')
} else {
console.log('❌ CSS class typo still present')
}
// Test 3: Check for debug logging helper
const hasDebugHelper = content.includes('function logDebug') && content.includes('logDebug(')
if (hasDebugHelper) {
console.log('✅ Debug logging helper added')
} else {
console.log('❌ Debug logging helper not found')
}
// Test 4: Check for improved error handling
const hasImprovedErrorHandling = content.includes('try {') && content.includes('Failed to clear channel onmessage')
if (hasImprovedErrorHandling) {
console.log('✅ Error handling improved')
} else {
console.log('❌ Error handling not improved')
}
// Test 5: Check for proper channel cleanup
const hasProperCleanup = content.includes('(channel as any).onmessage = null') && content.includes('(channel as any).close()')
if (hasProperCleanup) {
console.log('✅ Channel cleanup improved')
} else {
console.log('❌ Channel cleanup not properly improved')
}
// Test 6: Check for removed console.log in favor of logDebug
const logDebugCount = (content.match(/logDebug\(/g) || []).length
const consoleLogCount = (content.match(/console\.log\(/g) || []).length
if (logDebugCount > 0 && consoleLogCount === 0) {
console.log('✅ Console logging properly managed')
} else {
console.log('❌ Console logging not properly managed')
}
console.log('\nLoading component fix verification complete!')