Browse Source

test case update

master
filesite 8 months ago
parent
commit
fc4544109f
  1. 3
      index.mjs
  2. 3
      package.json
  3. 11
      test/heroUnion.test.mjs

3
index.mjs

@ -43,6 +43,7 @@ app.use((err, req, res, next) => { @@ -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);
});

3
package.json

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
"node-cron": "^3.0.2"
},
"scripts": {
"start": "node index.mjs"
"start": "node index.mjs",
"test": "node test/heroUnion.test.mjs"
}
}

11
test/heroUnion.test.mjs

@ -9,6 +9,11 @@ import axios from 'axios'; @@ -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) => { @@ -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) => { @@ -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);
});
});
Loading…
Cancel
Save