chore: merge dev to main #181

Merged
Anri merged 40 commits from dev into main 2024-09-27 20:49:36 +02:00
3 changed files with 30 additions and 2 deletions
Showing only changes of commit 7de418362e - Show all commits

View file

@ -45,7 +45,7 @@ export type dbReminder = {
* @param time raw text from user * @param time raw text from user
* @returns An object with the time and the option * @returns An object with the time and the option
*/ */
const splitTime = (time: string) => { export const splitTime = (time: string) => {
if (time?.endsWith("@")) { if (time?.endsWith("@")) {
return { time: time.slice(0, -1), option: OptionReminder.Mention }; return { time: time.slice(0, -1), option: OptionReminder.Mention };
} else if (time?.toLowerCase().endsWith("p")) { } else if (time?.toLowerCase().endsWith("p")) {

View file

@ -4,7 +4,7 @@ import {
isImage, isImage,
removeExtension, removeExtension,
splitFilenameExtensions, splitFilenameExtensions,
} from "../src/utils/misc"; } from "../../src/utils/misc";
describe("Filename splitter", () => { describe("Filename splitter", () => {
{ {

View file

@ -0,0 +1,28 @@
import { OptionReminder, splitTime } from "../../src/utils/reminder";
describe("Time splitter", () => {
{
const name = "";
test(name, () => {
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.Nothing, time: "" });
});
}
/* {
const name = "2m@p";
test(name, () => {
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.Mention, time: "2m" });
});
} */
{
const name = "41@";
test(name, () => {
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.Mention, time: "41" });
});
}
{
const name = "0P";
test(name, () => {
expect(splitTime(name)).toStrictEqual({ option: OptionReminder.DirectMessage, time: "0" });
});
}
});