Skip to content

Commit

Permalink
Fix whitespaces and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Mar 17, 2023
1 parent dae10f2 commit d60299c
Showing 1 changed file with 39 additions and 35 deletions.
74 changes: 39 additions & 35 deletions test/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@ import log from "../server/log";
import sinon from "ts-sinon";

describe("Client", function () {
const commonNetworkConfig: NetworkConfig = {
uuid: "67363f03-d903-498b-8e52-031ebb912791",
awayMessage: "",
name: "Super Nice Network",
nick: "thelounge0001",
host: "example.org",
port: 6667,
tls: false,
userDisconnected: false,
rejectUnauthorized: true,
password: "",
username: "thelounge",
realname: "thelounge26",
leaveMessage: "",
sasl: "",
saslAccount: "",
saslPassword: "",
commands: [],
ignoreList: [],
proxyHost: "",
proxyPort: 1080,
proxyUsername: "",
proxyEnabled: false,
proxyPassword: "",
channels: [],
};
const commonNetworkConfig: NetworkConfig = {
uuid: "67363f03-d903-498b-8e52-031ebb912791",
awayMessage: "",
name: "Super Nice Network",
nick: "thelounge0001",
host: "example.org",
port: 6667,
tls: false,
userDisconnected: false,
rejectUnauthorized: true,
password: "",
username: "thelounge",
realname: "thelounge26",
leaveMessage: "",
sasl: "",
saslAccount: "",
saslPassword: "",
commands: [],
ignoreList: [],
proxyHost: "",
proxyPort: 1080,
proxyUsername: "",
proxyEnabled: false,
proxyPassword: "",
channels: [],
};
let logWarnStub: sinon.SinonStub<string[], void>;

before(async function () {
logWarnStub = sinon.stub(log, "warn")
});
before(function () {
logWarnStub = sinon.stub(log, "warn");
});

after(async function () {
after(function () {
logWarnStub.restore();
});

it("should parse channel configuration", function () {
const manager = new ClientManager();
const channel: ChanConfig = {name: "AAAA!", type: "query"};
const networkConfig: NetworkConfig = {
...commonNetworkConfig,
...commonNetworkConfig,
channels: [{name: "AAAA!", type: "query"}, {name: "#thelounge"}, {name: "&foobar"}],
};
const client = new Client(manager, "test", {
Expand All @@ -63,7 +63,7 @@ describe("Client", function () {
// but this avoids the need to mock the irc-framework connection
const network = client.networkFromConfig(networkConfig);

sinon.assert.notCalled(logWarnStub);
sinon.assert.notCalled(logWarnStub);

expect(network.channels[0].name).to.equal("Super Nice Network");
expect(network.channels[0].type).to.equal(ChanType.LOBBY);
Expand All @@ -79,8 +79,12 @@ describe("Client", function () {
const manager = new ClientManager();
const channel: ChanConfig = {name: "AAAA!", type: "query"};
const networkConfig: NetworkConfig = {
...commonNetworkConfig,
channels: [{name: "AAAA!", type: "query"}, {name: "#thelounge", type: "wrongtype"}, {name: "&foobar"}],
...commonNetworkConfig,
channels: [
{name: "AAAA!", type: "query"},
{name: "#thelounge", type: "wrongtype"},
{name: "&foobar"},
],
};
const client = new Client(manager, "test", {
log: false,
Expand All @@ -94,7 +98,7 @@ describe("Client", function () {
// but this avoids the need to mock the irc-framework connection
const network = client.networkFromConfig(networkConfig);

sinon.assert.calledOnce(logWarnStub);
sinon.assert.calledOnce(logWarnStub);

expect(network.channels[0].name).to.equal("Super Nice Network");
expect(network.channels[0].type).to.equal(ChanType.LOBBY);
Expand Down

0 comments on commit d60299c

Please sign in to comment.