Notes edit and remove tests

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-04-25 00:07:18 +02:00
parent 294c4e3acd
commit e3f0fc5735
9 changed files with 43 additions and 290 deletions
+1 -6
View File
@@ -2,18 +2,13 @@
import Layout from "../../layouts/Layout.astro";
import { getCollection } from "astro:content";
import { ChevronRight, Shield } from "@lucide/astro";
import { getCategory } from "../../utils/notes";
const notes = await getCollection("notes");
const sortedNotes = notes.sort(
(a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime()
);
function getCategory(n: { id: string; data: { category?: string } }): string {
if (n.data.category) return n.data.category;
const parts = n.id.split("/");
return parts.length > 1 ? parts[0] : "General";
}
const categories = [...new Set(notes.map(getCategory))].sort();
const searchIndex = Object.fromEntries(