[ts-migrate][test] Init tsconfig.json file

Co-authored-by: ts-migrate <>
This commit is contained in:
Max Leiter 2022-05-02 23:35:08 -07:00
parent bdf0fcdbcb
commit 3de58c53b4
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
37 changed files with 100 additions and 250 deletions

View file

@ -1,40 +1,31 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const stub = require("sinon").stub;
const Auth = require("../../../client/js/auth").default;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'localStora... Remove this comment to see the full error message
const localStorage = require("../../../client/js/localStorage").default;
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'location'.
const location = require("../../../client/js/location").default;
import {expect} from "chai";
import {stub} from "sinon";
import Auth from "../../../client/js/auth";
import localStorage from "../../../client/js/localStorage";
import location from "../../../client/js/location";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("Auth", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe(".signout", function () {
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'beforeEach'.
beforeEach(function () {
stub(localStorage, "clear");
stub(location, "reload");
});
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'afterEach'.
afterEach(function () {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'restore' does not exist on type '() => v... Remove this comment to see the full error message
// @ts-expect- ts-migrate(2339) FIXME: Property 'restore' does not exist on type '() => v... Remove this comment to see the full error message
localStorage.clear.restore();
// @ts-expect-error ts-migrate(2339) FIXME: Property 'restore' does not exist on type '{ (): v... Remove this comment to see the full error message
location.reload.restore();
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should empty the local storage", function () {
Auth.signout();
// @ts-expect-error ts-migrate(2339) FIXME: Property 'calledOnce' does not exist on type '() =... Remove this comment to see the full error message
expect(localStorage.clear.calledOnce).to.be.true;
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should reload the page", function () {
Auth.signout();
// @ts-expect-error ts-migrate(2339) FIXME: Property 'calledOnce' does not exist on type '{ ()... Remove this comment to see the full error message

View file

@ -5,14 +5,11 @@ import constants from "../../../client/js/constants";
import {describe} from "mocha";
describe("client-side constants", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe(".colorCodeMap", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should be a non-empty array", function () {
expect(constants.colorCodeMap).to.be.an("array").of.length(16);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should be made of pairs of strings", function () {
constants.colorCodeMap.forEach(([code, name]) => {
expect(code)
@ -23,14 +20,11 @@ describe("client-side constants", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe(".condensedTypes", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should be a non-empty array", function () {
expect(constants.condensedTypes).to.be.an.instanceof(Set).that.is.not.empty;
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should only contain ASCII strings", function () {
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'type' implicitly has an 'any' type.
constants.condensedTypes.forEach((type) => {
@ -39,9 +33,7 @@ describe("client-side constants", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe(".timeFormats", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should be objects of strings", function () {
expect(constants.timeFormats.msgDefault).to.be.an("string").that.is.not.empty;
expect(constants.timeFormats.msgWithSeconds).to.be.an("string").that.is.not.empty;

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const friendlysize = require("../../../../client/js/helpers/friendlysize").default;
import {expect} from "chai";
import friendlysize from "../../../../client/js/helpers/friendlysize";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("friendlysize helper", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should render human-readable version", function () {
expect(friendlysize(51200)).to.equal("50 KiB");
expect(friendlysize(2)).to.equal("2 Bytes");
@ -18,17 +15,14 @@ describe("friendlysize helper", function () {
expect(friendlysize(Math.pow(1024, 5))).to.equal("1 PiB");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should round with 1 digit", function () {
expect(friendlysize(1234567)).to.equal("1.2 MiB");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should render special case 0 as 0 Bytes", function () {
expect(friendlysize(0)).to.equal("0 Bytes");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should render max safe integer as petabytes", function () {
expect(friendlysize(Number.MAX_SAFE_INTEGER)).to.equal("8 PiB");
});

View file

@ -1,13 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const anyIntersection =
require("../../../../../client/js/helpers/ircmessageparser/anyIntersection").default;
import {expect} from "chai";
import anyIntersection from "../../../../../client/js/helpers/ircmessageparser/anyIntersection";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("anyIntersection", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not intersect on edges", () => {
const a = {start: 1, end: 2};
const b = {start: 2, end: 3};
@ -16,7 +12,6 @@ describe("anyIntersection", () => {
expect(anyIntersection(b, a)).to.equal(false);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should intersect on overlapping", () => {
const a = {start: 0, end: 3};
const b = {start: 1, end: 2};
@ -25,7 +20,6 @@ describe("anyIntersection", () => {
expect(anyIntersection(b, a)).to.equal(true);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not intersect", () => {
const a = {start: 0, end: 1};
const b = {start: 2, end: 3};

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const cleanIrcMessage = require("../../../../../client/js/helpers/ircmessageparser/cleanIrcMessage");
import {expect} from "chai";
import cleanIrcMessage from "../../../../../client/js/helpers/ircmessageparser/cleanIrcMessage";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("cleanIrcMessage", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should remove all formatting", function () {
const testCases = [
{

View file

@ -1,14 +1,11 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const fill = require("../../../../../client/js/helpers/ircmessageparser/fill").default;
import {expect} from "chai";
import fill from "../../../../../client/js/helpers/ircmessageparser/fill";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("fill", () => {
const text = "01234567890123456789";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should return an entry for the unmatched end of string", () => {
const existingEntries = [
{start: 0, end: 10},
@ -22,7 +19,6 @@ describe("fill", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should return an entry per unmatched areas of the text", () => {
const existingEntries = [
{start: 0, end: 5},
@ -39,7 +35,6 @@ describe("fill", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not return anything when entries match all text", () => {
const existingEntries = [
{start: 0, end: 10},

View file

@ -1,13 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const findChannels =
require("../../../../../client/js/helpers/ircmessageparser/findChannels").default;
import {expect} from "chai";
import findChannels from "../../../../../client/js/helpers/ircmessageparser/findChannels";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("findChannels", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find single letter channel", () => {
const input = "#a";
const expected = [
@ -23,7 +19,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find utf8 channels", () => {
const input = "#äöü";
const expected = [
@ -39,7 +34,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find inline channel", () => {
const input = "inline #channel text";
const expected = [
@ -55,7 +49,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should stop at \\0x07", () => {
const input = "#chan\x07nel";
const expected = [
@ -71,7 +64,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should allow classics pranks", () => {
const input = "#1,000";
const expected = [
@ -87,7 +79,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should work with whois responses", () => {
const input = "@#a";
const expected = [
@ -103,7 +94,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should work with IRCv3.1 multi-prefix", () => {
const input = "!@%+#a";
const expected = [
@ -119,7 +109,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should work with custom channelPrefixes", () => {
const input = "@a";
const expected = [
@ -135,7 +124,6 @@ describe("findChannels", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should handle multiple channelPrefix correctly", () => {
const input = "##test";
const expected = [

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const findEmoji = require("../../../../../client/js/helpers/ircmessageparser/findEmoji").default;
import {expect} from "chai";
import findEmoji from "../../../../../client/js/helpers/ircmessageparser/findEmoji";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("findEmoji", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find default emoji presentation character", () => {
const input = "test \u{231A} test";
const expected = [
@ -22,7 +19,6 @@ describe("findEmoji", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find default text presentation character rendered as emoji", () => {
const input = "test \u{2194}\u{FE0F} test";
const expected = [
@ -38,7 +34,6 @@ describe("findEmoji", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find emoji modifier base", () => {
const input = "test\u{1F469}test";
const expected = [
@ -54,7 +49,6 @@ describe("findEmoji", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find emoji modifier base followed by a modifier", () => {
const input = "test\u{1F469}\u{1F3FF}test";
const expected = [

View file

@ -1,15 +1,12 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const {
import {expect} from "chai";
import {
findLinks,
findLinksWithSchema,
} = require("../../../../../client/js/helpers/ircmessageparser/findLinks");
} from "../../../../../client/js/helpers/ircmessageparser/findLinks";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("findLinks", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find url", () => {
const input = "irc://irc.example.com/thelounge";
const expected = [
@ -25,7 +22,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls with www", () => {
const input = "www.nooooooooooooooo.com";
const expected = [
@ -41,7 +37,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls in strings", () => {
const input = "look at https://thelounge.chat/ for more information";
const expected = [
@ -57,7 +52,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls in strings starting with www", () => {
const input = "use www.duckduckgo.com for privacy reasons";
const expected = [
@ -73,7 +67,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls with odd surroundings", () => {
const input = "<https://theos.kyriasis.com/~kyrias/stats/archlinux.html>";
const expected = [
@ -89,7 +82,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls with starting with http:// and odd surroundings", () => {
const input = ".:http://www.github.com:. .:www.github.com:.";
const expected = [
@ -105,7 +97,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find urls", () => {
const input = "text www. text";
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'expected' implicitly has type 'any[]' in... Remove this comment to see the full error message
@ -117,7 +108,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should handle multiple www. correctly", () => {
const input = "www.www.test.com";
const expected = [
@ -133,7 +123,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find domains without www. but valid tld", () => {
const input = "google.com google.lv google.museum";
const expected = [
@ -159,7 +148,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find .onion domains", () => {
const input = "facebookcorewwwi.onion/test?url";
const expected = [
@ -175,7 +163,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not consider invalid TLDs as domains", () => {
const input = "google.wtfgugl google.xx www.google.wtfgugl www.google.xx";
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'expected' implicitly has type 'any[]' in... Remove this comment to see the full error message
@ -187,7 +174,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should consider invalid TLDs as domains if protocol is specified", () => {
const input =
"http://google.wtfgugl http://google.xx http://www.google.wtfgugl http://www.google.xx";
@ -219,7 +205,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should correctly stop at punctuation", () => {
// Issue #2351
const input =
@ -279,7 +264,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should correctly stop at apostrophe", () => {
const input = "https://www.google.com's www.google.com's google.com's"; // Issue #1302
const expected = [
@ -305,7 +289,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("does not find invalid urls", () => {
const input = "www.example.com ssh://-oProxyCommand=whois"; // Issue #1412
const expected = [
@ -339,7 +322,6 @@ describe("findLinks", () => {
expect(actual2).to.deep.equal(expected2);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("keeps parsing after finding an invalid url", () => {
const input = "www.example.com http://a:%p@c http://thelounge.chat";
const expected = [
@ -365,7 +347,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should add protocol to protocol-aware urls", () => {
const input = "//example.com";
const expected = [
@ -381,7 +362,6 @@ describe("findLinks", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not return urls with no schema if flag is specified", () => {
const input = "https://example.global //example.com http://example.group example.py";
const expected = [

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const findNames = require("../../../../../client/js/helpers/ircmessageparser/findNames").default;
import {expect} from "chai";
import findNames from "../../../../../client/js/helpers/ircmessageparser/findNames";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("findNames", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find nicks in text", () => {
const input = "<MaxLeiter>: Hello, xPaw, how's it going?";
const expected = [
@ -27,7 +24,6 @@ describe("findNames", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find nicks as part of a bigger string (issue #1776)", () => {
const input = "you're very unlucky, luck";
const expected = [
@ -43,7 +39,6 @@ describe("findNames", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find nicks as short as one character (issue #1885)", () => {
const input = "aaa aa abc a";
const expected = [
@ -59,7 +54,6 @@ describe("findNames", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find same nick multiple times", () => {
const input = "xPaw xPaw xPaw";
const expected = [

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const merge = require("../../../../../client/js/helpers/ircmessageparser/merge").default;
import {expect} from "chai";
import merge from "../../../../../client/js/helpers/ircmessageparser/merge";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("merge", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should split style information", () => {
const textParts = [
{
@ -84,7 +81,6 @@ describe("merge", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not drop clean text", () => {
const textParts = [
{

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const parseStyle = require("../../../../../client/js/helpers/ircmessageparser/parseStyle").default;
import {expect} from "chai";
import parseStyle from "../../../../../client/js/helpers/ircmessageparser/parseStyle";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("parseStyle", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should replace control codes", () => {
const input = "text\x01with\x04control\x05codes";
const expected = [
@ -32,7 +29,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse bold", () => {
const input = "\x02bold";
const expected = [
@ -58,7 +54,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse strikethrough", () => {
const input = "\x1estrikethrough text\x1e";
const expected = [
@ -84,7 +79,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse monospace", () => {
const input = "\x11monospace text\x1e";
const expected = [
@ -110,7 +104,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should toggle monospace correctly", () => {
const input = "toggling \x11on and \x11off and \x11on again\x11";
const expected = [
@ -181,7 +174,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse monospace and underline", () => {
const input =
"\x1funderline formatting \x11with monospace\x1f no underline \x11 and vanilla";
@ -253,7 +245,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse monospace and text colors", () => {
const input = "\x037,9\x11text with color and monospace\x11\x03";
const expected = [
@ -279,7 +270,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse strikethrough and italics", () => {
const input = "\x1ditalic formatting \x1ewith strikethrough\x1d no italic \x1e and vanilla";
const expected = [
@ -350,7 +340,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse strikethrough and text colors", () => {
const input = "\x031,2text with color \x1eand strikethrough\x1e\x03";
const expected = [
@ -391,7 +380,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should correctly parse multiple unclosed format tokens", () => {
const input = "\x1e\x02\x1d\x033,4string with multiple unclosed formats";
const expected = [
@ -417,7 +405,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should toggle strikethrough correctly", () => {
const input = "toggling \x1eon and \x1eoff and \x1eon again\x1e";
const expected = [
@ -488,7 +475,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse textColor", () => {
const input = "\x038yellowText";
const expected = [
@ -514,7 +500,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse textColor and background", () => {
const input = "\x034,8yellowBG redText";
const expected = [
@ -540,7 +525,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse extended colors", () => {
const input = "\x0370,99some text";
const expected = [
@ -566,7 +550,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse italic", () => {
const input = "\x1ditalic";
const expected = [
@ -592,7 +575,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse hex colors", () => {
const input =
"test \x04FFFFFFnice \x02\x04RES006 \x0303,04\x04ff00FFcolored\x04eeeaFF,001122 background\x04\x03\x02?";
@ -694,7 +676,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should reverse and format color", () => {
const input = "\x032,9text with fg and bg \x16with text reversed";
const expected = [
@ -735,7 +716,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should toggle reverse correctly", () => {
const input = "\x0305,11text \x16reversed and \x16back again and \x16reversed";
const expected = [
@ -806,7 +786,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should escape reverse when a new style is applied", () => {
const input = "\x0311,02text \x16 reversed \x0304,05 and new style";
const expected = [
@ -862,7 +841,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not reverse if color is specified after reverse tag", () => {
const input = "\x16\x032,9text with fg and bg";
const expected = [
@ -888,7 +866,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should reverse, bold, and italics", () => {
const input = "\x034,13\x16\x02some text with \x1ditalics";
const expected = [
@ -929,7 +906,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should carry state correctly forward", () => {
const input = "\x02bold\x038yellow\x02nonBold\x03default";
const expected = [
@ -1000,7 +976,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should toggle bold correctly", () => {
const input = "\x02bold\x02 \x02bold\x02";
const expected = [
@ -1056,7 +1031,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should reset all styles", () => {
const input = "\x11\x1e\x02\x034\x16\x1d\x1ffull\x0fnone";
const expected = [
@ -1097,7 +1071,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not emit empty fragments", () => {
const input = "\x031\x031,2\x031\x031,2\x031\x031,2\x03a";
const expected = [
@ -1123,7 +1096,6 @@ describe("parseStyle", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should optimize fragments", () => {
const rawString = "oh hi test text";
const colorCode = "\x0312";

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const localetime = require("../../../../client/js/helpers/localetime").default;
import {expect} from "chai";
import localetime from "../../../../client/js/helpers/localetime";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("localetime helper", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should render a human-readable date", () => {
// 12PM in UTC time
const date = new Date("2014-05-22T12:00:00Z");

View file

@ -1,9 +1,8 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
import {renderToString} from "@vue/server-test-utils";
// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module '../../components/ParsedMessage... Remove this comment to see the full error message
import ParsedMessageTestWrapper from "../../components/ParsedMessageTestWrapper.vue";
async function getParsedMessageContents(text: any, message: any) {
@ -20,9 +19,7 @@ async function getParsedMessageContents(text: any, message: any) {
return contents;
}
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("IRC formatted message parser", () => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not introduce xss", async () => {
const testCases = [
{
@ -46,7 +43,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should skip all <32 ASCII codes except linefeed", async () => {
const testCases = [
{
@ -65,7 +61,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find urls", async () => {
const testCases = [
{
@ -118,7 +113,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("url with a dot parsed correctly", async () => {
const input =
"bonuspunkt: your URL parser misparses this URL: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644989(v=vs.85).aspx";
@ -134,7 +128,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(correctResult);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should balance brackets", async () => {
const testCases = [
{
@ -180,7 +173,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find urls", async () => {
const testCases = [
{
@ -202,7 +194,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find channels", async () => {
const testCases = [
{
@ -261,7 +252,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find channels", async () => {
const testCases = [
{
@ -374,14 +364,12 @@ describe("IRC formatted message parser", () => {
'<span class="irc-bold">bold</span>' + " " + '<span class="irc-bold">bold</span>',
},
].forEach(({name, input, expected}) => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it(`should handle style characters: ${name}`, async () => {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
expect(await getParsedMessageContents(input)).to.equal(expected);
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find nicks", async () => {
const testCases = [
{
@ -405,7 +393,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find nicks", async () => {
const testCases = [
{
@ -435,7 +422,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should go bonkers like mirc", async () => {
const testCases = [
{
@ -537,14 +523,12 @@ describe("IRC formatted message parser", () => {
'<span dir="auto" role="button" tabindex="0" class="inline-channel">#i❤thelounge</span>',
},
].forEach(({name, input, expected}) => {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it(`should find emoji: ${name}`, async () => {
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
expect(await getParsedMessageContents(input)).to.equal(expected);
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should optimize generated html", async () => {
const testCases = [
{
@ -566,7 +550,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should trim common protocols", async () => {
const testCases = [
{
@ -596,7 +579,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not find channel in fragment", async () => {
const testCases = [
{
@ -617,7 +599,6 @@ describe("IRC formatted message parser", () => {
expect(actual).to.deep.equal(expected);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not overlap parts", async () => {
const input = "Url: http://example.com/path Channel: ##channel";
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
@ -629,7 +610,6 @@ describe("IRC formatted message parser", () => {
);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should handle overlapping parts by using first starting", async () => {
const input = "#test-https://example.com";
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
@ -642,7 +622,6 @@ describe("IRC formatted message parser", () => {
);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should find links separated by tab character", async () => {
const input = "example.com\texample.org";
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.

View file

@ -1,12 +1,9 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const parseIrcUri = require("../../../../client/js/helpers/parseIrcUri").default;
import {expect} from "chai";
import parseIrcUri from "../../../../client/js/helpers/parseIrcUri";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("parseIrcUri helper", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse irc:// without port", function () {
expect(parseIrcUri("irc://example.com")).to.deep.equal({
tls: false,
@ -17,7 +14,6 @@ describe("parseIrcUri helper", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse ircs:// without port", function () {
expect(parseIrcUri("ircs://example.com")).to.deep.equal({
tls: true,
@ -28,7 +24,6 @@ describe("parseIrcUri helper", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse irc:// with port", function () {
expect(parseIrcUri("irc://example.com:1337")).to.deep.equal({
tls: false,
@ -39,7 +34,6 @@ describe("parseIrcUri helper", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse ircs:// with port", function () {
expect(parseIrcUri("ircs://example.com:1337")).to.deep.equal({
tls: true,
@ -50,17 +44,14 @@ describe("parseIrcUri helper", function () {
});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not parse invalid port", function () {
expect(parseIrcUri("ircs://example.com:lol")).to.deep.equal({});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not parse plus in port", function () {
expect(parseIrcUri("irc://example.com:+6697")).to.deep.equal({});
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should not channel on empty query and hash", function () {
const obj = {
tls: false,
@ -75,7 +66,6 @@ describe("parseIrcUri helper", function () {
expect(parseIrcUri("irc://example.com/#")).to.deep.equal(obj);
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should parse multiple channels", function () {
const obj = {
tls: true,

View file

@ -1,27 +1,21 @@
"use strict";
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'expect'.
const expect = require("chai").expect;
const roundBadgeNumber = require("../../../../client/js/helpers/roundBadgeNumber").default;
import {expect} from "chai";
import roundBadgeNumber from "../../../../client/js/helpers/roundBadgeNumber";
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
describe("roundBadgeNumber helper", function () {
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should return any number under 1000 as a string", function () {
expect(roundBadgeNumber(123)).to.equal("123");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should return numbers above 999 in thousands", function () {
expect(roundBadgeNumber(1000)).to.be.equal("1.0k");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should round and not floor", function () {
expect(roundBadgeNumber(9999)).to.be.equal("10.0k");
});
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'it'. Do you need to install type... Remove this comment to see the full error message
it("should always include a single digit when rounding up", function () {
expect(roundBadgeNumber(1234)).to.be.equal("1.2k");
expect(roundBadgeNumber(12345)).to.be.equal("12.3k");

View file

@ -9,6 +9,7 @@ import config from "../../src/config";
config.setHome(home);
import STSPolicies from "../../src/plugins/sts"; // Must be imported *after* setHome
const mochaGlobalTeardown = async function () {
STSPolicies.refresh.cancel(); // Cancel debounced function, so it does not write later
fs.unlinkSync(STSPolicies.stsFile);

View file

@ -3,6 +3,7 @@ import {expect} from "chai";
import Chan from "../../src/models/chan";
import Msg from "../../src/models/msg";
import Prefix from "../../src/models/prefix";
import User from "../../src/models/user";
describe("Chan", function () {
const network = {
@ -19,7 +20,7 @@ describe("Chan", function () {
},
};
const prefixLookup = {modeToSymbol: {}};
const prefixLookup = {modeToSymbol: {}} as Prefix;
network.network.options.PREFIX.forEach((mode) => {
prefixLookup.modeToSymbol[mode.mode] = mode.symbol;
@ -38,7 +39,7 @@ describe("Chan", function () {
});
it("should find a message in the list of messages", function () {
expect(chan.findMessage(2).text).to.equal("Message to be found");
expect(chan.findMessage(2)?.text).to.equal("Message to be found");
});
it("should not find a message that does not exist", function () {
@ -82,7 +83,7 @@ describe("Chan", function () {
});
describe("#getSortedUsers(irc)", function () {
const getUserNames = function (chan) {
const getUserNames = function (chan: Chan) {
return chan.getSortedUsers(network).map((u) => u.nick);
};

View file

@ -1,9 +1,9 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const Msg = require("../../src/models/msg");
const User = require("../../src/models/user");
import Msg from "../../src/models/msg";
import User from "../../src/models/user";
describe("Msg", function () {
["from", "target"].forEach((prop) => {

View file

@ -1,13 +1,13 @@
"use strict";
const expect = require("chai").expect;
const Chan = require("../../src/models/chan");
const Msg = require("../../src/models/msg");
const User = require("../../src/models/user");
const Network = require("../../src/models/network");
const Config = require("../../src/config");
const STSPolicies = require("../../src/plugins/sts");
const ClientCertificate = require("../../src/plugins/clientCertificate");
import {expect} from "chai";
import Chan from "../../src/models/chan";
import Msg from "../../src/models/msg";
import User from "../../src/models/user";
import Network from "../../src/models/network";
import Config from "../../src/config";
import STSPolicies from "../../src/plugins/sts";
import ClientCertificate from "../../src/plugins/clientCertificate";
describe("Network", function () {
describe("Network(attr)", function () {

View file

@ -1,12 +1,12 @@
"use strict";
const log = require("../../../src/log");
const ldapAuth = require("../../../src/plugins/auth/ldap");
const Config = require("../../../src/config");
const ldap = require("ldapjs");
const expect = require("chai").expect;
const stub = require("sinon").stub;
const TestUtil = require("../../util");
import log from "../../../src/log";
import ldapAuth from "../../../src/plugins/auth/ldap";
import Config from "../../../src/config";
import ldap from "ldapjs";
import {expect} from "chai";
import {stub} from "sinon";
import TestUtil from "../../util";
const user = "johndoe";
const wrongUser = "eve";

View file

@ -1,10 +1,10 @@
"use strict";
const fs = require("fs");
const path = require("path");
const {expect} = require("chai");
const ClientCertificate = require("../../src/plugins/clientCertificate");
const Config = require("../../src/config");
import fs from "fs";
import path from "path";
import {expect} from "chai";
import ClientCertificate from "../../src/plugins/clientCertificate";
import Config from "../../src/config";
describe("ClientCertificate", function () {
it("should not generate a client certificate in public mode", function () {

View file

@ -1,7 +1,7 @@
"use strict";
const expect = require("chai").expect;
const inputs = require("../../../src/plugins/inputs");
import {expect} from "chai";
import inputs from "../../../src/plugins/inputs";
describe("inputs", function () {
describe(".getCommands", function () {

View file

@ -1,10 +1,10 @@
"use strict";
const path = require("path");
const expect = require("chai").expect;
const util = require("../util");
const Config = require("../../src/config");
const link = require("../../src/plugins/irc-events/link.js");
import path from "path";
import {expect} from "chai";
import util from "../util";
import Config from "../../src/config";
import link from "../../src/plugins/irc-events/link.js";
describe("Link plugin", function () {
// Increase timeout due to unpredictable I/O on CI services

View file

@ -1,9 +1,9 @@
"use strict";
const log = require("../../../src/log");
const expect = require("chai").expect;
const stub = require("sinon").stub;
const TestUtil = require("../../util");
import log from "../../../src/log";
import {expect} from "chai";
import {stub} from "sinon";
import TestUtil from "../../util";
let packages;

View file

@ -1,12 +1,12 @@
"use strict";
const fs = require("fs");
const path = require("path");
const expect = require("chai").expect;
const util = require("../util");
const Msg = require("../../src/models/msg");
const Config = require("../../src/config");
const MessageStorage = require("../../src/plugins/messageStorage/sqlite.js");
import fs from "fs";
import path from "path";
import {expect} from "chai";
import util from "../util";
import Msg from "../../src/models/msg";
import Config from "../../src/config";
import MessageStorage from "../../src/plugins/messageStorage/sqlite.js";
describe("SQLite Message Storage", function () {
// Increase timeout due to unpredictable I/O on CI services

View file

@ -1,13 +1,14 @@
"use strict";
const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
const expect = require("chai").expect;
const util = require("../util");
const Config = require("../../src/config");
const storage = require("../../src/plugins/storage");
const link = require("../../src/plugins/irc-events/link.js");
import fs from "fs";
import path from "path";
import crypto from "crypto";
import {expect} from "chai";
import util from "../util";
import Config from "../../src/config";
import storage from "../../src/plugins/storage";
import link from "../../src/plugins/irc-events/link.js";
import {Request, Response} from "express";
describe("Image storage", function () {
// Increase timeout due to unpredictable I/O on CI services
@ -116,7 +117,7 @@ describe("Image storage", function () {
text: "http://localhost:" + port + "/svg-preview",
});
this.app.get("/svg-preview", function (req, res) {
this.app.get("/svg-preview", function (req: Request, res: Response) {
res.send(
"<title>test title</title><meta property='og:image' content='http://localhost:" +
port +

View file

@ -1,7 +1,7 @@
"use strict";
const log = require("../../../src/log");
const expect = require("chai").expect;
import {expect} from "chai";
const stub = require("sinon").stub;
const TestUtil = require("../../util");
const Utils = require("../../../src/command-line/utils");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const os = require("os");
const Helper = require("../../src/helper");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const fs = require("fs");
const path = require("path");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const stub = require("sinon").stub;
const log = require("../../src/log");
const Client = require("../../src/client");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const Helper = require("../../src/helper");
describe("HexIP", function () {

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const Helper = require("../../src/helper");
describe("Hostmask", function () {

View file

@ -1,7 +1,7 @@
"use strict";
const log = require("../../src/log");
const expect = require("chai").expect;
import {expect} from "chai";
const stub = require("sinon").stub;
const Config = require("../../src/config");
const TestUtil = require("../util");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const Network = require("../../src/models/network");

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const Helper = require("../../src/helper");
describe("Client passwords", function () {

View file

@ -1,6 +1,6 @@
"use strict";
const expect = require("chai").expect;
import {expect} from "chai";
const TextFileMessageStorage = require("../../src/plugins/messageStorage/text");
describe("TextFileMessageStorage", function () {