Skip to content

Commit

Permalink
tests cleanup, added nyc as dev-dep, bumping dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Supinic committed Feb 14, 2021
1 parent 5783631 commit ab7eb18
Show file tree
Hide file tree
Showing 3 changed files with 853 additions and 342 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"update": "git pull origin master && yarn upgrade supi-core",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "mocha tests/twitch"
"test": "nyc mocha tests/twitch"
},
"main": "master.js",
"author": "Supinic <[email protected]>",
Expand All @@ -30,6 +30,7 @@
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.1.0",
"mocha": "^8.3.0"
"mocha": "^8.3.0",
"nyc": "^15.1.0"
}
}
25 changes: 9 additions & 16 deletions tests/twitch/twitch.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
const { strictEqual: equal } = require("assert");
const assert = require("assert");

require("dank-twitch-irc");
const MockClient = require("./mock-client.js");
require.cache[require.resolve("dank-twitch-irc")].exports = MockClient;

const _debug = console.debug;
console.stuff = [];
console.debug = (...args) => {
console.stuff.push(...args);
_debug(...args);
};

const initialize = (async () => {
await require("supi-core")("sb", {
whitelist: [
Expand Down Expand Up @@ -90,13 +83,13 @@ const initialize = (async () => {
]);

const userCheck = await sb.User.get("supinic");
equal(userCheck instanceof sb.User, true);
assert.strictEqual(userCheck instanceof sb.User, true);

const channelCheck = sb.Channel.get("supinic");
equal(channelCheck instanceof sb.Channel, true);
assert.strictEqual(channelCheck instanceof sb.Channel, true);

equal(sb.Command.prefix, "$");
equal(sb.Command.is("$test"), true);
assert.strictEqual(sb.Command.prefix, "$");
assert.strictEqual(sb.Command.is("$test"), true);
});

describe("twitch controller", function () {
Expand Down Expand Up @@ -133,9 +126,9 @@ describe("twitch controller", function () {

const invoked = {};
controller.send = (reply) => {
equal(invoked.message, true);
equal(invoked.command, true);
equal(reply, expected.reply);
assert.strictEqual(invoked.message, true);
assert.strictEqual(invoked.command, true);
assert.strictEqual(reply, expected.reply);

done();
};
Expand Down Expand Up @@ -171,6 +164,6 @@ describe("twitch controller", function () {

controller.client.emit("error", error);

equal(controller.failedJoinChannels.size, 1);
assert.strictEqual(controller.failedJoinChannels.size, 1);
});
});
Loading

0 comments on commit ab7eb18

Please sign in to comment.