Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Jul 8, 2024
1 parent 04130e4 commit df10780
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: npm run start-test-server

- name: Test server response
run: npm run test-400
run: npm run test-200

- name: Stop server after testing
run: pkill node || true
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"scripts": {
"start": "node backend.js",
"build": "npm run start",
"test": "npm run test-400",
"test": "npm run test-200",
"start-test-server": "node backend.js &",
"test-400": "node test.js"
"test-200": "node test.js"
},
"keywords": [
"proxy",
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const axios = require('axios');
async function testServerResponse() {
try {
const response = await axios.get('http://localhost:8080/');
if (response.status === 400) {
console.log('Server responded with status code 400. Test passed.');
if (response.status === 200) {
console.log('Server responded with status code 200. Test passed.');
process.exit(0); // Exit with success
} else {
console.error(`Expected status code 400 but received ${response.status}. Test failed.`);
console.error(`Expected status code 200 but received ${response.status}. Test failed.`);
process.exit(1); // Exit with failure
}
} catch (error) {
Expand Down

0 comments on commit df10780

Please sign in to comment.