chore: merge dev
to main
#181
3 changed files with 30 additions and 2 deletions
|
@ -45,7 +45,7 @@ export type dbReminder = {
|
|||
* @param time raw text from user
|
||||
* @returns An object with the time and the option
|
||||
*/
|
||||
const splitTime = (time: string) => {
|
||||
export const splitTime = (time: string) => {
|
||||
if (time?.endsWith("@")) {
|
||||
return { time: time.slice(0, -1), option: OptionReminder.Mention };
|
||||
} else if (time?.toLowerCase().endsWith("p")) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
isImage,
|
||||
removeExtension,
|
||||
splitFilenameExtensions,
|
||||
} from "../src/utils/misc";
|
||||
} from "../../src/utils/misc";
|
||||
|
||||
describe("Filename splitter", () => {
|
||||
{
|
28
tests/utils/reminder.test.ts
Normal file
28
tests/utils/reminder.test.ts
Normal 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" });
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue