diff --git a/src/utils/note.test.ts b/src/utils/note.test.ts
new file mode 100644
index 00000000..d123050f
--- /dev/null
+++ b/src/utils/note.test.ts
@@ -0,0 +1,28 @@
+import { assertEquals } from '@std/assert';
+
+import { getMediaLinks, parseNoteContent } from '@/utils/note.ts';
+
+Deno.test('parseNoteContent', () => {
+ const { html, links, firstUrl } = parseNoteContent('Hello, world!');
+ assertEquals(html, 'Hello, world!');
+ assertEquals(links, []);
+ assertEquals(firstUrl, undefined);
+});
+
+Deno.test('getMediaLinks', () => {
+ const links = [
+ { href: 'https://example.com/image.png' },
+ { href: 'https://example.com/index.html' },
+ { href: 'https://example.com/yolo' },
+ { href: 'https://example.com/' },
+ ];
+ const mediaLinks = getMediaLinks(links);
+ assertEquals(mediaLinks, [
+ {
+ url: 'https://example.com/image.png',
+ data: {
+ mime: 'image/png',
+ },
+ },
+ ]);
+});
diff --git a/src/utils/note.ts b/src/utils/note.ts
index 71dc0174..580c2072 100644
--- a/src/utils/note.ts
+++ b/src/utils/note.ts
@@ -58,7 +58,7 @@ function parseNoteContent(content: string): ParsedNoteContent {
};
}
-function getMediaLinks(links: Link[]): DittoAttachment[] {
+function getMediaLinks(links: Pick[]): DittoAttachment[] {
return links.reduce((acc, link) => {
const mediaType = getUrlMediaType(link.href);
if (!mediaType) return acc;