chore: merge branch dev to main #195

Merged
Anri merged 18 commits from dev into main 2024-10-14 23:41:43 +02:00
Showing only changes of commit c7fff7520b - Show all commits

View file

@ -60,6 +60,68 @@ describe("Attachements Handler", () => {
]),
);
expect(embedTest).toStrictEqual(embedExpected);
});
}
{
const name = "Two fields with multiples files each";
test(name, () => {
// 102 is the maximum for [f](url) before rupture
const max = 102;
const total = 150;
const embedExpected = new EmbedBuilder();
embedExpected.addFields(
{
name: "yes_s (1)",
value: Array.from({ length: max }, () => "[f](url)").join(", "),
},
{
name: "yes_s (2)",
value: Array.from({ length: total - max }, () => "[f](url)").join(", "),
},
);
const embedTest = new EmbedBuilder();
handleAttachments(
map,
embedTest,
new Collection(
Array.from({ length: total }, () => [newKey(), { name: "f", url: "url" } as Attachment]),
),
);
expect(embedTest).toStrictEqual(embedExpected);
});
}
{
const name = "Two fields with one field with one element";
test(name, () => {
// 102 is the maximum for [f](url) before rupture
const max = 102;
const total = 103;
const embedExpected = new EmbedBuilder();
embedExpected.addFields(
{
name: "yes_s (1)",
value: Array.from({ length: max }, () => "[f](url)").join(", "),
},
{
name: "no_s (2)",
value: Array.from({ length: total - max }, () => "[f](url)").join(", "),
},
);
const embedTest = new EmbedBuilder();
handleAttachments(
map,
embedTest,
new Collection(
Array.from({ length: total }, () => [newKey(), { name: "f", url: "url" } as Attachment]),
),
);
expect(embedTest).toStrictEqual(embedExpected);
});
}