-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-components.js
More file actions
116 lines (105 loc) · 3.4 KB
/
test-components.js
File metadata and controls
116 lines (105 loc) · 3.4 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Test script to verify all components and data are loading correctly
const fs = require('fs');
const path = require('path');
console.log('🧪 Testing NutriClassify Components...\n');
// Test if all screens exist
const screens = [
'FoodListScreen',
'FoodDetailScreen',
'RecipeListScreen',
'RecipeDetailScreen',
'NutritionEducationScreen',
'ProfileScreen',
'SearchScreen'
];
console.log('📱 Checking Screens:');
screens.forEach(screen => {
const screenPath = path.join(__dirname, 'src', 'screens', `${screen}.tsx`);
if (fs.existsSync(screenPath)) {
console.log(` ✅ ${screen}`);
} else {
console.log(` ❌ ${screen} - NOT FOUND`);
}
});
// Test if all components exist
const components = [
'Card',
'SearchInput',
'FilterChip'
];
console.log('\n🧩 Checking Components:');
components.forEach(component => {
const componentPath = path.join(__dirname, 'src', 'components', `${component}.tsx`);
if (fs.existsSync(componentPath)) {
console.log(` ✅ ${component}`);
} else {
console.log(` ❌ ${component} - NOT FOUND`);
}
});
// Test if data files exist
const dataFiles = [
'nigerianFoods',
'recipes'
];
console.log('\n📊 Checking Data Files:');
dataFiles.forEach(dataFile => {
const dataPath = path.join(__dirname, 'src', 'data', `${dataFile}.ts`);
if (fs.existsSync(dataPath)) {
console.log(` ✅ ${dataFile}`);
// Count items in data file
const content = fs.readFileSync(dataPath, 'utf8');
if (dataFile === 'nigerianFoods') {
const matches = content.match(/id: '/g);
if (matches) {
console.log(` 📝 ${matches.length} Nigerian foods loaded`);
}
} else if (dataFile === 'recipes') {
const matches = content.match(/id: '/g);
if (matches) {
console.log(` 📝 ${matches.length} recipes loaded`);
}
}
} else {
console.log(` ❌ ${dataFile} - NOT FOUND`);
}
});
// Test navigation
const navigationPath = path.join(__dirname, 'src', 'navigation', 'AppNavigator.tsx');
console.log('\n🧭 Checking Navigation:');
if (fs.existsSync(navigationPath)) {
console.log(' ✅ AppNavigator exists');
const navContent = fs.readFileSync(navigationPath, 'utf8');
const tabs = ['Foods', 'Recipes', 'Search', 'Learn', 'Profile'];
tabs.forEach(tab => {
if (navContent.includes(`name="${tab}"`)) {
console.log(` ✅ ${tab} tab configured`);
} else {
console.log(` ❌ ${tab} tab missing`);
}
});
} else {
console.log(' ❌ AppNavigator - NOT FOUND');
}
// Test store
const storePath = path.join(__dirname, 'src', 'store', 'useStore.ts');
console.log('\n💾 Checking State Management:');
if (fs.existsSync(storePath)) {
console.log(' ✅ Zustand store configured');
const storeContent = fs.readFileSync(storePath, 'utf8');
const features = ['nutritionLogs', 'favoriteRecipes', 'favoriteFoods', 'shoppingList'];
features.forEach(feature => {
if (storeContent.includes(feature)) {
console.log(` ✅ ${feature} state management`);
} else {
console.log(` ❌ ${feature} missing`);
}
});
} else {
console.log(' ❌ Store - NOT FOUND');
}
console.log('\n✨ Component testing complete!');
console.log('\n📱 To run the app:');
console.log(' 1. Scan the QR code with Expo Go app');
console.log(' 2. Or press "w" in terminal for web');
console.log(' 3. Or press "i" for iOS simulator');
console.log(' 4. Or press "a" for Android emulator\n');