forked from PamudaUposath/Creators-Space-GroupProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-projects.html
More file actions
106 lines (98 loc) · 3.9 KB
/
test-projects.html
File metadata and controls
106 lines (98 loc) · 3.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Projects Page</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.test-result { padding: 10px; margin: 10px 0; border-radius: 5px; }
.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
</style>
</head>
<body>
<h1>Projects Page Test</h1>
<div id="test-results">
<div class="test-result info">Running tests...</div>
</div>
<script>
const testResults = document.getElementById('test-results');
function addResult(message, type = 'info') {
const div = document.createElement('div');
div.className = `test-result ${type}`;
div.textContent = message;
testResults.appendChild(div);
}
// Test 1: Check if projects.json exists
fetch('./src/data/projects.json')
.then(response => {
if (response.ok) {
addResult('✅ projects.json file found and accessible', 'success');
return response.json();
} else {
throw new Error('projects.json not found');
}
})
.then(data => {
addResult(`✅ Loaded ${data.length} projects from JSON file`, 'success');
})
.catch(error => {
addResult(`❌ Error loading projects.json: ${error.message}`, 'error');
});
// Test 2: Check if GitHub API is accessible
fetch('https://api.github.com/search/repositories?q=stars:>100&sort=stars&order=desc&per_page=5')
.then(response => {
if (response.ok) {
addResult('✅ GitHub API is accessible', 'success');
return response.json();
} else {
throw new Error(`GitHub API returned ${response.status}`);
}
})
.then(data => {
addResult(`✅ GitHub API returned ${data.items.length} repositories`, 'success');
})
.catch(error => {
addResult(`❌ GitHub API error: ${error.message}`, 'error');
});
// Test 3: Check if CSS files exist
fetch('./src/css/projects.css')
.then(response => {
if (response.ok) {
addResult('✅ projects.css file found', 'success');
} else {
throw new Error('projects.css not found');
}
})
.catch(error => {
addResult(`❌ Error loading projects.css: ${error.message}`, 'error');
});
// Test 4: Check if JavaScript file exists
fetch('./src/js/projects.js')
.then(response => {
if (response.ok) {
addResult('✅ projects.js file found', 'success');
} else {
throw new Error('projects.js not found');
}
})
.catch(error => {
addResult(`❌ Error loading projects.js: ${error.message}`, 'error');
});
// Test 5: Check if projects.html exists
fetch('./projects.html')
.then(response => {
if (response.ok) {
addResult('✅ projects.html file found', 'success');
} else {
throw new Error('projects.html not found');
}
})
.catch(error => {
addResult(`❌ Error loading projects.html: ${error.message}`, 'error');
});
</script>
</body>
</html>