Skip to content

Build your personal knowledge base with Trilium Notes

test(client): assert the sort dialog sends the first level's direction

BeatLink03d5339b803f
diff --git a/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx b/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
index 060ed1ad8a..2e1ea1aa07 100644
--- a/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
+++ b/apps/client/src/widgets/dialogs/sort_child_notes.spec.tsx
@@ -87,6 +87,7 @@ describe("SortChildNotesDialog", () => {
await submit();
expect(put).toHaveBeenCalledWith("notes/parent/sort-children", expect.objectContaining({
sortBy: "title asc",
+ sortDirection: "asc",
foldersFirst: false,
sortNatural: false
}));
@@ -108,8 +109,10 @@ describe("SortChildNotesDialog", () => {
expect(levels()).toHaveLength(2);
await submit();
+ // The first level's direction is the request's, which is what groups folders last.
expect(put).toHaveBeenCalledWith("notes/parent/sort-children", expect.objectContaining({
- sortBy: "priority desc, dateModified asc"
+ sortBy: "priority desc, dateModified asc",
+ sortDirection: "desc"
}));
});
@@ -123,7 +126,8 @@ describe("SortChildNotesDialog", () => {
await click(second.querySelector(".sort-level-up"));
await submit();
expect(put).toHaveBeenCalledWith("notes/parent/sort-children", expect.objectContaining({
- sortBy: "dateCreated asc, title asc"
+ sortBy: "dateCreated asc, title asc",
+ sortDirection: "asc"
}));
});