tiammomo d8db4e1bf4
feat(scheduled-tasks): search task titles and prompts (#5355)
* feat(scheduled-tasks): search task titles and prompts

Signed-off-by: tiammomo <26957354+tiammomo@users.noreply.github.com>

* docs(scheduled-tasks): separate search from time validation notes

Signed-off-by: tiammomo <26957354+tiammomo@users.noreply.github.com>

* fix(frontend): order scheduled-task imports

---------

Signed-off-by: tiammomo <26957354+tiammomo@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-09-18 09:25:32 +08:00

26 lines
584 B
TypeScript

import { expect, test } from "@rstest/core";
import { matchesScheduledTaskQuery } from "@/core/scheduled-tasks/search";
const task = {
title: "Weekly REPORT [draft]",
prompt: "汇总项目进度 and revenue",
};
test.each([
["", true],
[" ", true],
[" report ", true],
["REVENUE", true],
["项目进度", true],
["[draft]", true],
[".*", false],
["missing", false],
["draft] 汇总", false],
])(
"matches query %s as a literal title or prompt substring",
(query, expected) => {
expect(matchesScheduledTaskQuery(task, query)).toBe(expected);
},
);