Change IRC server and channels in tests to more generic

This commit is contained in:
Mateusz Hajder 2021-05-26 13:43:06 +02:00
parent af236dd280
commit 28c413319f
No known key found for this signature in database
GPG Key ID: 5BFE5D3F97914EC8
4 changed files with 19 additions and 19 deletions

View File

@ -55,8 +55,8 @@ describe("cleanIrcMessage", function () {
expected: "bold bold", expected: "bold bold",
}, },
{ {
input: "\x02irc\x0f://\x1dfreenode.net\x0f/\x034,8thelounge", input: "\x02irc\x0f://\x1dirc.example.com\x0f/\x034,8thelounge",
expected: "irc://freenode.net/thelounge", expected: "irc://irc.example.com/thelounge",
}, },
{ {
input: "\x02#\x038,9thelounge", input: "\x02#\x038,9thelounge",

View File

@ -8,12 +8,12 @@ const {
describe("findLinks", () => { describe("findLinks", () => {
it("should find url", () => { it("should find url", () => {
const input = "irc://freenode.net/thelounge"; const input = "irc://irc.example.com/thelounge";
const expected = [ const expected = [
{ {
start: 0, start: 0,
end: 28, end: 28,
link: "irc://freenode.net/thelounge", link: "irc://irc.example.com/thelounge",
}, },
]; ];

View File

@ -63,10 +63,10 @@ describe("IRC formatted message parser", () => {
it("should find urls", async () => { it("should find urls", async () => {
const testCases = [ const testCases = [
{ {
input: "irc://freenode.net/thelounge", input: "irc://irc.example.com/thelounge",
expected: expected:
'<a href="irc://freenode.net/thelounge" dir="auto" target="_blank" rel="noopener">' + '<a href="irc://irc.example.com/thelounge" dir="auto" target="_blank" rel="noopener">' +
"irc://freenode.net/thelounge" + "irc://irc.example.com/thelounge" +
"</a>", "</a>",
}, },
{ {
@ -416,12 +416,12 @@ describe("IRC formatted message parser", () => {
it("should go bonkers like mirc", async () => { it("should go bonkers like mirc", async () => {
const testCases = [ const testCases = [
{ {
input: "\x02irc\x0f://\x1dfreenode.net\x0f/\x034,8thelounge", input: "\x02irc\x0f://\x1dirc.example.com\x0f/\x034,8thelounge",
expected: expected:
'<a href="irc://freenode.net/thelounge" dir="auto" target="_blank" rel="noopener">' + '<a href="irc://irc.example.com/thelounge" dir="auto" target="_blank" rel="noopener">' +
'<span class="irc-bold">irc</span>' + '<span class="irc-bold">irc</span>' +
"://" + "://" +
'<span class="irc-italic">freenode.net</span>' + '<span class="irc-italic">irc.example.com</span>' +
"/" + "/" +
'<span class="irc-fg4 irc-bg8">thelounge</span>' + '<span class="irc-fg4 irc-bg8">thelounge</span>' +
"</a>", "</a>",

View File

@ -91,7 +91,7 @@ describe("Network", function () {
rejectUnauthorized: false, rejectUnauthorized: false,
}); });
expect(network.validate()).to.be.true; expect(network.validate()).to.be.true;
expect(network.host).to.equal("chat.freenode.net"); expect(network.host).to.equal("irc.example.com");
expect(network.port).to.equal(6697); expect(network.port).to.equal(6697);
expect(network.tls).to.be.true; expect(network.tls).to.be.true;
expect(network.rejectUnauthorized).to.be.true; expect(network.rejectUnauthorized).to.be.true;
@ -103,7 +103,7 @@ describe("Network", function () {
host: "some.fake.tld", host: "some.fake.tld",
}); });
expect(network2.validate()).to.be.true; expect(network2.validate()).to.be.true;
expect(network2.host).to.equal("chat.freenode.net"); expect(network2.host).to.equal("irc.example.com");
Helper.config.lockNetwork = false; Helper.config.lockNetwork = false;
}); });
@ -265,7 +265,7 @@ describe("Network", function () {
// Lobby and initial channel // Lobby and initial channel
expect(network.channels.length).to.equal(2); expect(network.channels.length).to.equal(2);
const newChan = new Chan({name: "#freenode"}); const newChan = new Chan({name: "#foo"});
network.addChannel(newChan); network.addChannel(newChan);
expect(network.channels.length).to.equal(3); expect(network.channels.length).to.equal(3);
@ -278,13 +278,13 @@ describe("Network", function () {
const network = new Network({ const network = new Network({
channels: [chan1, chan2, chan3], channels: [chan1, chan2, chan3],
name: "freenode", name: "foo",
}); });
const newChan = new Chan({name: "#freenode"}); const newChan = new Chan({name: "#foo"});
network.addChannel(newChan); network.addChannel(newChan);
expect(network.channels[0].name).to.equal("freenode"); expect(network.channels[0].name).to.equal("foo");
expect(network.channels[1]).to.equal(chan1); expect(network.channels[1]).to.equal(chan1);
expect(network.channels[2]).to.equal(newChan); expect(network.channels[2]).to.equal(newChan);
expect(network.channels[3]).to.equal(chan2); expect(network.channels[3]).to.equal(chan2);
@ -299,7 +299,7 @@ describe("Network", function () {
channels: [chan1, chan2], channels: [chan1, chan2],
}); });
const newChan = new Chan({name: "#freenode"}); const newChan = new Chan({name: "#foo"});
network.addChannel(newChan); network.addChannel(newChan);
expect(network.channels[1]).to.equal(chan1); expect(network.channels[1]).to.equal(chan1);
@ -393,7 +393,7 @@ describe("Network", function () {
channels: [banlist, chan1, user1], channels: [banlist, chan1, user1],
}); });
const newChan = new Chan({name: "#freenode"}); const newChan = new Chan({name: "#foo"});
network.addChannel(newChan); network.addChannel(newChan);
expect(network.channels[1]).to.equal(newChan); expect(network.channels[1]).to.equal(newChan);
@ -404,7 +404,7 @@ describe("Network", function () {
it("should never add something in front of the lobby", function () { it("should never add something in front of the lobby", function () {
const network = new Network({ const network = new Network({
name: "freenode", name: "foo",
channels: [], channels: [],
}); });