tests: use node:test #210
9 changed files with 674 additions and 3323 deletions
|
@ -293,11 +293,14 @@ Il est souhaité d'écrire des tests quand cela est possible.
|
|||
```ts
|
||||
import { fnReturnsTrue } from "../src/utils/file";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("test name", () => {
|
||||
{
|
||||
const name = "to be tested";
|
||||
test(name, () => {
|
||||
expect(fnReturnsTrue() /* function to test */).toBe(true /* expected result */);
|
||||
it(name, () => {
|
||||
assert.strictEqual(fnReturnsTrue() /* function to test */, true /* expected result */);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
3727
package-lock.json
generated
3727
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -10,7 +10,7 @@
|
|||
"lint": "npx eslint src",
|
||||
"format-check": "npx prettier --check src",
|
||||
"format-write": "npx prettier --write src",
|
||||
"test": "npx jest"
|
||||
"test": "node --import tsx --test --experimental-strip-types"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -31,16 +31,11 @@
|
|||
"uuid": "^11.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "~29.5.14",
|
||||
"@typescript-eslint/eslint-plugin": "~8.17.0",
|
||||
"@typescript-eslint/parser": "~8.17.0",
|
||||
"dotenv": "~16.4.7",
|
||||
"jest": "~29.7.0",
|
||||
"prettier-eslint": "~16.3.0",
|
||||
"ts-jest": "~29.2.5",
|
||||
"ts-node-dev": "~2.0.0"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest"
|
||||
"ts-node-dev": "~2.0.0",
|
||||
"tsx": "^4.19.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,37 @@
|
|||
import "../../modules/string";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("Capitalize", () => {
|
||||
{
|
||||
const name = "test";
|
||||
test(name, () => {
|
||||
expect(name.capitalize()).toBe("Test");
|
||||
it(name, () => {
|
||||
assert.strictEqual(name.capitalize(), "Test");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "MACHIN";
|
||||
test(name, () => {
|
||||
expect(name.capitalize()).toBe("MACHIN");
|
||||
it(name, () => {
|
||||
assert.strictEqual(name.capitalize(), "MACHIN");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "tRUC";
|
||||
test(name, () => {
|
||||
expect(name.capitalize()).toBe("TRUC");
|
||||
it(name, () => {
|
||||
assert.strictEqual(name.capitalize(), "TRUC");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "Super";
|
||||
test(name, () => {
|
||||
expect(name.capitalize()).toBe("Super");
|
||||
it(name, () => {
|
||||
assert.strictEqual(name.capitalize(), "Super");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "";
|
||||
test(name, () => {
|
||||
expect(name.capitalize()).toBe("");
|
||||
it(name, () => {
|
||||
assert.strictEqual(name.capitalize(), "");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
import { OptionReminder, splitTime } from "../../../utils/commands/reminder";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("Time splitter", () => {
|
||||
{
|
||||
const name = "";
|
||||
test(name, () => {
|
||||
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.Nothing, time: "" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitTime(name), { option: OptionReminder.Nothing, time: "" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "2m@p";
|
||||
test(name, () => {
|
||||
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.DirectMessage, time: "2m" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitTime(name), { option: OptionReminder.DirectMessage, time: "2m" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "41@";
|
||||
test(name, () => {
|
||||
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.Mention, time: "41" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitTime(name), { option: OptionReminder.Mention, time: "41" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "0P";
|
||||
test(name, () => {
|
||||
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.DirectMessage, time: "0" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitTime(name), { option: OptionReminder.DirectMessage, time: "0" });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { Attachment, Collection, EmbedBuilder } from "discord.js";
|
||||
import { handleAttachments } from "../../../utils/events/citation";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
/**
|
||||
* Generate a new random string
|
||||
* @returns random string
|
||||
|
@ -17,7 +20,7 @@ describe("Attachements Handler", () => {
|
|||
const max_field = Array.from({ length: max }, () => "[f](url)").join(", ");
|
||||
{
|
||||
const name = "One image";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const embedExpected = new EmbedBuilder();
|
||||
embedExpected.setImage("http://url");
|
||||
|
||||
|
@ -28,12 +31,12 @@ describe("Attachements Handler", () => {
|
|||
new Collection([[newKey(), { name: "image.png", url: "http://url" } as Attachment]]),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "Two images";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const embedExpected = new EmbedBuilder();
|
||||
embedExpected.addFields({
|
||||
name: "yes_s",
|
||||
|
@ -50,12 +53,12 @@ describe("Attachements Handler", () => {
|
|||
]),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "One link";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const embedExpected = new EmbedBuilder();
|
||||
embedExpected.addFields({ name: "no_s", value: "[f](url)" });
|
||||
|
||||
|
@ -66,12 +69,12 @@ describe("Attachements Handler", () => {
|
|||
new Collection([[newKey(), { name: "f", url: "url" } as Attachment]]),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "Two files";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const embedExpected = new EmbedBuilder();
|
||||
embedExpected.addFields({ name: "yes_s", value: "[f](url), [f](url)" });
|
||||
|
||||
|
@ -85,12 +88,12 @@ describe("Attachements Handler", () => {
|
|||
]),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "Two fields with multiples files each";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const total = 150;
|
||||
|
||||
const embedExpected = new EmbedBuilder();
|
||||
|
@ -114,12 +117,12 @@ describe("Attachements Handler", () => {
|
|||
),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "Two fields with one field with one element";
|
||||
test(name, () => {
|
||||
it(name, () => {
|
||||
const total = 103;
|
||||
|
||||
const embedExpected = new EmbedBuilder();
|
||||
|
@ -143,7 +146,7 @@ describe("Attachements Handler", () => {
|
|||
),
|
||||
);
|
||||
|
||||
expect(embedTest).toStrictEqual(embedExpected);
|
||||
assert.deepStrictEqual(embedTest, embedExpected);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,32 +6,32 @@ import {
|
|||
splitFilenameExtensions,
|
||||
} from "../../utils/misc";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("Filename splitter", () => {
|
||||
{
|
||||
const name = "test.js";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: "test", ext: "js" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitFilenameExtensions(name), { file: "test", ext: "js" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: ".env", ext: undefined });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitFilenameExtensions(name), { file: ".env", ext: undefined });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env.test";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({
|
||||
file: ".env",
|
||||
ext: "test",
|
||||
});
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitFilenameExtensions(name), { file: ".env", ext: "test" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "file.test.js";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: "file.test", ext: "js" });
|
||||
it(name, () => {
|
||||
assert.deepStrictEqual(splitFilenameExtensions(name), { file: "file.test", ext: "js" });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -39,26 +39,26 @@ describe("Filename splitter", () => {
|
|||
describe("Extension remover", () => {
|
||||
{
|
||||
const name = "test.js";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe("test");
|
||||
it(name, () => {
|
||||
assert.strictEqual(removeExtension(name), "test");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe(".env");
|
||||
it(name, () => {
|
||||
assert.strictEqual(removeExtension(name), ".env");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env.test";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe(".env");
|
||||
it(name, () => {
|
||||
assert.strictEqual(removeExtension(name), ".env");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "file.test.js";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe("file.test");
|
||||
it(name, () => {
|
||||
assert.strictEqual(removeExtension(name), "file.test");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -66,38 +66,38 @@ describe("Extension remover", () => {
|
|||
describe("Image checker", () => {
|
||||
{
|
||||
const name = "image.Png";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.jpeg";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.wav";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(false);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), false);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.jpg";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.webP";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.GIF";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
it(name, () => {
|
||||
assert.strictEqual(isImage(name), true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -105,26 +105,27 @@ describe("Image checker", () => {
|
|||
describe("Code block cleaner", () => {
|
||||
{
|
||||
const name = "salut";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe("`salut`");
|
||||
it(name, () => {
|
||||
assert.strictEqual(cleanCodeBlock(name), "`salut`");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "<@158260864623968257> ça va ?";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe("<@158260864623968257>` ça va ?`");
|
||||
it(name, () => {
|
||||
assert.strictEqual(cleanCodeBlock(name), "<@158260864623968257>` ça va ?`");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "t'as vu la vidéo ? https://youtu.be/dQw4w9WgXcQ";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe("`t'as vu la vidéo ? `https://youtu.be/dQw4w9WgXcQ");
|
||||
it(name, () => {
|
||||
assert.strictEqual(cleanCodeBlock(name), "`t'as vu la vidéo ? `https://youtu.be/dQw4w9WgXcQ");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "t'as vu la vidéo ? https://youtu.be/dQw4w9WgXcQ elle est cool en vrai tqt";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe(
|
||||
it(name, () => {
|
||||
assert.strictEqual(
|
||||
cleanCodeBlock(name),
|
||||
"`t'as vu la vidéo ? `https://youtu.be/dQw4w9WgXcQ` elle est cool en vrai tqt`",
|
||||
);
|
||||
});
|
||||
|
@ -134,16 +135,18 @@ describe("Code block cleaner", () => {
|
|||
describe("Emoji to link", () => {
|
||||
{
|
||||
const name = "☺️";
|
||||
test(name, () => {
|
||||
expect(emojiPng(name)).toBe(
|
||||
it(name, () => {
|
||||
assert.strictEqual(
|
||||
emojiPng(name),
|
||||
"https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/263a.png",
|
||||
);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "🍕";
|
||||
test(name, () => {
|
||||
expect(emojiPng(name)).toBe(
|
||||
it(name, () => {
|
||||
assert.strictEqual(
|
||||
emojiPng(name),
|
||||
"https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/1f355.png",
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
import { RegexC, RegExpFlags } from "../../utils/regex";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("Regex flags", () => {
|
||||
test("One parameter", () => {
|
||||
it("One parameter", () => {
|
||||
const regex = RegexC("", RegExpFlags.Global);
|
||||
expect(regex.global).toBeTruthy();
|
||||
assert.strictEqual(regex.global, true);
|
||||
});
|
||||
|
||||
test("All parameters", () => {
|
||||
it("All parameters", () => {
|
||||
const regex = RegexC(
|
||||
"",
|
||||
RegExpFlags.Global |
|
||||
|
@ -16,11 +19,11 @@ describe("Regex flags", () => {
|
|||
RegExpFlags.Unicode |
|
||||
RegExpFlags.SingleLine,
|
||||
);
|
||||
expect(regex.global).toBeTruthy();
|
||||
expect(regex.multiline).toBeTruthy();
|
||||
expect(regex.ignoreCase).toBeTruthy();
|
||||
expect(regex.sticky).toBeTruthy();
|
||||
expect(regex.unicode).toBeTruthy();
|
||||
expect(regex.dotAll).toBeTruthy();
|
||||
assert.strictEqual(regex.global, true);
|
||||
assert.strictEqual(regex.multiline, true);
|
||||
assert.strictEqual(regex.ignoreCase, true);
|
||||
assert.strictEqual(regex.sticky, true);
|
||||
assert.strictEqual(regex.unicode, true);
|
||||
assert.strictEqual(regex.dotAll, true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,33 +6,38 @@ import {
|
|||
TimeSecond,
|
||||
} from "../../utils/time";
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
describe("Date with correct timezone", () => {
|
||||
const map = new Map([["u_time_at", "@"]]);
|
||||
const date = new Date(1727434767686);
|
||||
{
|
||||
const name = "fr";
|
||||
test(name, () => {
|
||||
expect(showDate(name, map, date)).toBe("27/09/2024 @ 12:59:27");
|
||||
it(name, () => {
|
||||
assert.strictEqual(showDate(name, map, date), "27/09/2024 @ 12:59:27");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "en-US";
|
||||
test(name, () => {
|
||||
expect(showDate(name, map, date)).toBe("9/27/24, @ 1:59:27");
|
||||
it(name, () => {
|
||||
assert.strictEqual(showDate(name, map, date), "9/27/24, @ 1:59:27");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "unknown";
|
||||
// Depends on the system
|
||||
// The important is that the date is in the correct timezone (UTC)
|
||||
test(name, () => {
|
||||
expect(["27/09/2024 @ 10:59:27", "9/27/24, @ 10:59:27"]).toContain(showDate(name, map, date));
|
||||
it(name, () => {
|
||||
assert.ok(
|
||||
["27/09/2024 @ 10:59:27", "9/27/24, @ 10:59:27"].includes(showDate(name, map, date)),
|
||||
);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "zh-CN";
|
||||
test(name, () => {
|
||||
expect(showDate(name, map, date)).toBe("2024/9/27 @ 18:59:27");
|
||||
it(name, () => {
|
||||
assert.strictEqual(showDate(name, map, date), "2024/9/27 @ 18:59:27");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -40,26 +45,26 @@ describe("Date with correct timezone", () => {
|
|||
describe("String time to seconds", () => {
|
||||
{
|
||||
const name = "10m30";
|
||||
test(name, () => {
|
||||
expect(strToSeconds(name)).toBe(630);
|
||||
it(name, () => {
|
||||
assert.strictEqual(strToSeconds(name), 630);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "12h30";
|
||||
test(name, () => {
|
||||
expect(strToSeconds(name)).toBe(45000);
|
||||
it(name, () => {
|
||||
assert.strictEqual(strToSeconds(name), 45000);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "12s30";
|
||||
test(name, () => {
|
||||
expect(strToSeconds(name)).toBe(42);
|
||||
it(name, () => {
|
||||
assert.strictEqual(strToSeconds(name), 42);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "1w30h20";
|
||||
test(name, () => {
|
||||
expect(strToSeconds(name)).toBe(714000);
|
||||
it(name, () => {
|
||||
assert.strictEqual(strToSeconds(name), 714000);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -67,54 +72,54 @@ describe("String time to seconds", () => {
|
|||
describe("Next time unit", () => {
|
||||
{
|
||||
const name = TimeSecond.Minute;
|
||||
test(name.toString(), () => {
|
||||
expect(nextTimeUnit(name)).toBe(TimeSecond.Second);
|
||||
it(name.toString(), () => {
|
||||
assert.strictEqual(nextTimeUnit(name), TimeSecond.Second);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = TimeSecond.Hour;
|
||||
test(name.toString(), () => {
|
||||
expect(nextTimeUnit(name)).toBe(TimeSecond.Minute);
|
||||
it(name.toString(), () => {
|
||||
assert.strictEqual(nextTimeUnit(name), TimeSecond.Minute);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = TimeSecond.Second;
|
||||
test(name.toString(), () => {
|
||||
expect(nextTimeUnit(name)).toBe(TimeSecond.Second);
|
||||
it(name.toString(), () => {
|
||||
assert.strictEqual(nextTimeUnit(name), TimeSecond.Second);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = TimeSecond.Year;
|
||||
test(name.toString(), () => {
|
||||
expect(nextTimeUnit(name)).toBe(TimeSecond.Week);
|
||||
it(name.toString(), () => {
|
||||
assert.strictEqual(nextTimeUnit(name), TimeSecond.Week);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("Relative time", () => {
|
||||
// Thoses tests are based on time, we have 10s of acceptance.
|
||||
// Thoses its are based on time, we have 10s of acceptance.
|
||||
{
|
||||
const name = Date.now() + (10 * TimeSecond.Minute + 30) * 1000;
|
||||
test(name.toString(), () => {
|
||||
expect(timeDeltaToString(name)).toMatch(/10m 30s|10m 2\ds/);
|
||||
it(name.toString(), () => {
|
||||
assert.match(timeDeltaToString(name), /10m 30s|10m 2\ds/);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = Date.now() + (12 * TimeSecond.Hour + 30 * TimeSecond.Minute) * 1000;
|
||||
test(name.toString(), () => {
|
||||
expect(timeDeltaToString(name)).toMatch(/12h 30m|12h 29m 5\ds/);
|
||||
it(name.toString(), () => {
|
||||
assert.match(timeDeltaToString(name), /12h 30m|12h 29m 5\ds/);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = Date.now() + (TimeSecond.Week + TimeSecond.Day + 6 * TimeSecond.Hour) * 1000;
|
||||
test(name.toString(), () => {
|
||||
expect(timeDeltaToString(name)).toMatch(/1w 1d 6h|1w 1d 5h 59m 5\ds/);
|
||||
it(name.toString(), () => {
|
||||
assert.match(timeDeltaToString(name), /1w 1d 6h|1w 1d 5h 59m 5\ds/);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = Date.now();
|
||||
test(name.toString(), () => {
|
||||
expect(timeDeltaToString(name)).toMatch(/\ds/);
|
||||
it(name.toString(), () => {
|
||||
assert.match(timeDeltaToString(name), /\ds/);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue