Skip to content

Commit

Permalink
βœ… πŸ“Œ Updated tests and set dependency version. KamandPrompt#140
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeconias authored and LalitNM committed Oct 19, 2020
1 parent 7304636 commit 5605459
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ io.on('connection', (socket) => {
name = (name || "").trim()

//if name is empty(null), do nothing
if(!name) return socket.emit('user invalid', {username: `${name} is invalid.`});
if(!name) return socket.emit('user invalid', `This user name is invalid.`);

//if username is not taken
else if(rooms[0].users.indexOf(name) == -1) {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"main": "index.js",
"scripts": {
"start": "node app.js",
"test:watch": "mocha --watch ./*.test.js",
"test": "mocha ./*.test.js"
"test:watch": "mocha --watch ./tests/**/*.test.js",
"test": "mocha ./tests/**/*.test.js"
},
"engines": {
"npm": "3.10.10",
"node": "12.19.0"
"node": "6.9.4"
},
"repository": {
"type": "git",
Expand All @@ -27,8 +27,8 @@
"socket.io": "^1.7.2"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^8.2.0",
"socket.io-client": "^2.3.1"
"chai": "4.2.0",
"mocha": "6.2.3",
"socket.io-client": "2.3.1"
}
}
5 changes: 2 additions & 3 deletions app.test.js β†’ tests/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ describe("App.js", () => {
assert.isTrue(client.connected);

client.on("user invalid", (data) => {
assert.isObject(data);
assert.hasAllKeys(data, "username");
assert.strictEqual(data.username, " is invalid.");
assert.isString(data);
assert.strictEqual(data, "This user name is invalid.");
done();
});

Expand Down

0 comments on commit 5605459

Please sign in to comment.