Skip to content
Snippets Groups Projects
Commit b05bd04f authored by Joonas Seppä's avatar Joonas Seppä
Browse files

Testien lisäys ja testiautomaatio Gitlabin CI-pipelinellä

parent 4544d219
No related branches found
No related tags found
No related merge requests found
Pipeline #52660 failed
image: node:latest
test:
stage: test
script:
- npm test
\ No newline at end of file
......@@ -51,5 +51,8 @@ app.post('/moveRight', (req, res) => {
}
});
//Export for tests:
module.exports = players;
const port = process.env.PORT || 3010;
app.listen(port, () => console.log("Listening on port " + port));
\ No newline at end of file
......@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "npm start",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "Mocha"
},
"keywords": [],
"author": "",
......
var assert = require('assert');
var players = require('../index.js');
describe("Pelaaja-lista", function(){
it("On olemassa", function(){
assert.equal(typeof(players), 'object');
});
it("Kaksi demopelaajaa", function(){
assert.equal(players.length, 2);
});
it("Demopelaajat eri paikoissa", function(){
assert.notEqual(players[0].left, players[1].left);
});
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment