diff --git a/index.mjs b/index.mjs index 6ebd764..1b425c7 100644 --- a/index.mjs +++ b/index.mjs @@ -43,6 +43,7 @@ app.use((err, req, res, next) => { // Listen to the App Engine-specified port, or 8080 otherwise const PORT = process.env.PORT || 8080; -app.listen(PORT, async () => { +const HOST = '127.0.0.1'; +app.listen(PORT, HOST, async () => { console.log('Server listening on port %s...', PORT); }); diff --git a/package.json b/package.json index 4115fae..6996f5c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "node-cron": "^3.0.2" }, "scripts": { - "start": "node index.mjs" + "start": "node index.mjs", + "test": "node test/heroUnion.test.mjs" } } diff --git a/test/heroUnion.test.mjs b/test/heroUnion.test.mjs index fbbacf1..e20a79b 100644 --- a/test/heroUnion.test.mjs +++ b/test/heroUnion.test.mjs @@ -9,6 +9,11 @@ import axios from 'axios'; import common from '../common.mjs'; import HeroUnion from '../heroUnion.mjs'; +const axiosConfig = { + timeout: 5000, + proxy: false +}; + test('Hero onboard test', async (t) => { let params = { name: 'test_hero', @@ -21,7 +26,7 @@ test('Hero onboard test', async (t) => { let api = 'http://127.0.0.1:8080/api/onboard/'; - const response = await axios.post(api, params, {timeout: 5000}); + const response = await axios.post(api, params, axiosConfig); console.log(response.data); assert.equal(response.status, 200); @@ -31,8 +36,8 @@ test('Hero onboard test', async (t) => { test('HeroUnion stats test', async (t) => { let api = 'http://127.0.0.1:8080/api/stats/'; - const response = await axios.get(api, {timeout: 5000}); + const response = await axios.get(api, axiosConfig); console.log(response.data); assert.equal(response.status, 200); -}); +}); \ No newline at end of file