Compare commits
No commits in common. "d03aa48ff3062b3c61afda13cb8f824ff6c5a8ad" and "af4585ee2f0e54de218a9c199ce61327b353d17b" have entirely different histories.
d03aa48ff3
...
af4585ee2f
2 changed files with 4 additions and 159 deletions
|
@ -294,12 +294,9 @@ Il est souhaité d'écrire des tests quand cela est possible.
|
|||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { fnReturnsTrue } = require("../src/utils/misc");
|
||||
|
||||
describe("test name", () => {
|
||||
{
|
||||
const name = "to be tested";
|
||||
test(name, () => {
|
||||
describe("test description", () => {
|
||||
test("test name", () => {
|
||||
expect(fnReturnsTrue() /* function to test */).toBe(true /* expected result */);
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
const {
|
||||
cleanCodeBlock,
|
||||
emojiPng,
|
||||
isImage,
|
||||
removeExtension,
|
||||
splitFilenameExtensions,
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
} = require("../src/utils/misc");
|
||||
|
||||
describe("Filename splitter", () => {
|
||||
{
|
||||
const name = "test.js";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: "test", ext: "js" });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: ".env", ext: undefined });
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env.test";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({
|
||||
file: ".env",
|
||||
ext: "test",
|
||||
});
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "file.test.js";
|
||||
test(name, () => {
|
||||
expect(splitFilenameExtensions(name)).toStrictEqual({ file: "file.test", ext: "js" });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("Extension remover", () => {
|
||||
{
|
||||
const name = "test.js";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe("test");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe(".env");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = ".env.test";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe(".env");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "file.test.js";
|
||||
test(name, () => {
|
||||
expect(removeExtension(name)).toBe("file.test");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("Image checker", () => {
|
||||
{
|
||||
const name = "image.Png";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.jpeg";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.wav";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(false);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.jpg";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.webP";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "image.GIF";
|
||||
test(name, () => {
|
||||
expect(isImage(name)).toBe(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("Code block cleaner", () => {
|
||||
{
|
||||
const name = "salut";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe("`salut`");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "<@158260864623968257> ça va ?";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe("<@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");
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "t'as vu la vidéo ? https://youtu.be/dQw4w9WgXcQ elle est cool en vrai tqt";
|
||||
test(name, () => {
|
||||
expect(cleanCodeBlock(name)).toBe(
|
||||
"`t'as vu la vidéo ? `https://youtu.be/dQw4w9WgXcQ` elle est cool en vrai tqt`",
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("test name", () => {
|
||||
{
|
||||
const name = "☺️";
|
||||
test(name, () => {
|
||||
expect(emojiPng(name)).toBe(
|
||||
"https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/263a.png",
|
||||
);
|
||||
});
|
||||
}
|
||||
{
|
||||
const name = "🍕";
|
||||
test(name, () => {
|
||||
expect(emojiPng(name)).toBe(
|
||||
"https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/72x72/1f355.png",
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Add table
Reference in a new issue