-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-setup.js
More file actions
executable file
·72 lines (62 loc) · 2.03 KB
/
test-setup.js
File metadata and controls
executable file
·72 lines (62 loc) · 2.03 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
60
61
62
63
64
65
66
67
68
69
70
71
72
// Simple setup validation for our plugin
console.log('Validating email performance plugin structure...');
const fs = require('fs');
const path = require('path');
const srcDir = './src';
const expectedDirs = ['components', 'hooks', 'services', 'types', 'utils'];
const expectedFiles = [
'EmailPerformancePlugin.tsx',
'types/email.ts',
'services/emailApi.ts',
'hooks/useEmailPerformance.ts',
'utils/formatters.ts'
];
let allTestsPassed = true;
// Check if main directories exist
for (const dir of expectedDirs) {
const dirPath = path.join(srcDir, dir);
if (!fs.existsSync(dirPath)) {
console.error(`❌ Missing directory: ${dirPath}`);
allTestsPassed = false;
} else {
console.log(`✅ Found directory: ${dirPath}`);
}
}
// Check for key files
for (const file of expectedFiles) {
const filePath = path.join(srcDir, file);
if (!fs.existsSync(filePath)) {
console.error(`❌ Missing file: ${filePath}`);
allTestsPassed = false;
} else {
console.log(`✅ Found file: ${filePath}`);
}
}
// Check that each component has the required files
const components = fs.readdirSync(path.join(srcDir, 'components'));
for (const comp of components) {
const compPath = path.join(srcDir, 'components', comp);
if (fs.statSync(compPath).isDirectory()) {
// Check for main component file and CSS module
const tsxFile = `${comp}.tsx`;
const cssFile = `${comp}.module.css`;
if (!fs.existsSync(path.join(compPath, tsxFile))) {
console.error(`❌ Missing TSX file in component: ${comp}`);
allTestsPassed = false;
} else {
console.log(`✅ Found TSX file for component: ${comp}`);
}
if (!fs.existsSync(path.join(compPath, cssFile))) {
console.error(`❌ Missing CSS module for component: ${comp}`);
allTestsPassed = false;
} else {
console.log(`✅ Found CSS module for component: ${comp}`);
}
}
}
if (allTestsPassed) {
console.log('\n🎉 All structure checks passed!');
} else {
console.error('\n❌ Some structure checks failed.');
process.exit(1);
}