Skip to content

Commit a01eac4

Browse files
Yih-Chun HuYih-Chun Hu
authored andcommitted
fix: find snooze settings by days and durations
1 parent d1c3c33 commit a01eac4

4 files changed

Lines changed: 26 additions & 14 deletions

File tree

‎apps/mobile/src/features/settings/settings-search.test.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,20 @@ describe("filterSettingsSections", () => {
6666
expect(filterSettingsSections([{ rows: [] }, ...SECTIONS], "").length).toBe(SECTIONS.length);
6767
});
6868

69-
it("finds snooze presets on the General page", () => {
70-
const sections = [
71-
{
72-
rows: [
73-
{ id: "SettingsOrganization", label: "General" },
74-
{ id: "SettingsThreads", label: "Threads" },
75-
],
76-
},
77-
];
78-
expect(filterSettingsSections(sections, "snooze presets")).toEqual([
79-
{ rows: [{ id: "SettingsOrganization", label: "General" }] },
80-
]);
81-
});
69+
it.each(["snooze presets", "weekday", "168 hours"])(
70+
"finds snooze presets on the General page for %s",
71+
(query) => {
72+
const sections = [
73+
{
74+
rows: [
75+
{ id: "SettingsOrganization", label: "General" },
76+
{ id: "SettingsThreads", label: "Threads" },
77+
],
78+
},
79+
];
80+
expect(filterSettingsSections(sections, query)).toEqual([
81+
{ rows: [{ id: "SettingsOrganization", label: "General" }] },
82+
]);
83+
},
84+
);
8285
});

‎apps/mobile/src/features/settings/settings-search.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const SETTINGS_SEARCH_TERMS = {
4242
"last project",
4343
"snooze presets",
4444
"wake times",
45+
"today tomorrow next week weekday weekdays monday tuesday wednesday thursday friday saturday sunday morning afternoon evening tonight time duration durations relative absolute date hours days seven 1 3 7 168",
4546
],
4647
SettingsThreads: [
4748
"new threads",

‎apps/web/src/components/settings/settingsSearch.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ const ITEMS: ReadonlyArray<SettingsSearchItem> = [
5252
];
5353

5454
describe("searchSettings", () => {
55+
it.each(["weekday", "168 hours"])("finds snooze presets for %s", (query) => {
56+
expect(searchSettings(query)).toContainEqual(
57+
expect.objectContaining({ id: "snooze-presets", to: "/settings/general" }),
58+
);
59+
});
60+
5561
it("matches titles, sections, and remembered setting details", () => {
5662
expect(searchSettings("word", ITEMS).map((item) => item.id)).toEqual(["word-wrap"]);
5763
expect(searchSettings("network", ITEMS).map((item) => item.id)).toEqual(["network-access"]);

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ export const SETTINGS_SEARCH_ITEMS = [
429429
id: "snooze-presets",
430430
title: "Snooze presets",
431431
to: "/settings/general",
432-
searchTerms: ["tomorrow next week Monday morning evening time hours seven days"],
432+
searchTerms: [
433+
"today tomorrow next week weekday weekdays monday tuesday wednesday thursday friday saturday sunday morning afternoon evening tonight time duration durations relative absolute date hours days seven 1 3 7 168",
434+
],
433435
},
434436
{
435437
id: "auto-settle-inactive-threads",

0 commit comments

Comments
 (0)