-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
42 lines (33 loc) Β· 1.41 KB
/
test.js
File metadata and controls
42 lines (33 loc) Β· 1.41 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
import fetch from 'node-fetch';
const baseUrl = 'http://localhost:5000';
console.log('π§ͺ Running tests...');
async function runTests() {
// Test 1: Check if server is running
try {
const response = await fetch(baseUrl);
if (response.status === 200) {
console.log('β
Test 1 PASSED: Server is running and responding');
} else {
console.log('β Test 1 FAILED: Server returned status code', response.status);
}
// Test 2: Check if static files are served
try {
const staticResponse = await fetch(baseUrl + '/public/css/styles.css');
if (staticResponse.status === 200) {
console.log('β
Test 2 PASSED: Static files are being served');
} else {
console.log('β Test 2 FAILED: Static files returned status code', staticResponse.status);
}
} catch (error) {
console.log('β Test 2 FAILED: Static files not accessible');
console.log(' Error:', error.message);
}
console.log('\nπ Tests completed!');
console.log('π Note: Email functionality requires SENDGRID_API_KEY environment variable');
} catch (error) {
console.log('β Test 1 FAILED: Server is not running');
console.log(' Error:', error.message);
process.exit(1);
}
}
runTests();