From 8a6a6712e7554f110b5ef951f270d88fd010e040 Mon Sep 17 00:00:00 2001
From: Bertrand Yuan <noreply@bertyuan.com>
Date: Thu, 26 Mar 2026 00:02:16 +0800
Subject: add more tests

---
 src/components/inline-link.test.tsx | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 src/components/inline-link.test.tsx

(limited to 'src/components/inline-link.test.tsx')

diff --git a/src/components/inline-link.test.tsx b/src/components/inline-link.test.tsx
new file mode 100644
index 0000000..ad9813d
--- /dev/null
+++ b/src/components/inline-link.test.tsx
@@ -0,0 +1,41 @@
+import { render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { describe, expect, test, vi } from 'vitest';
+import { InlineLink } from './inline-link';
+
+vi.mock('next/link', () => ({
+  default: ({
+    href,
+    children,
+    ...props
+  }: {
+    href: string;
+    children: ReactNode;
+  }) => (
+    <a href={href} {...props}>
+      {children}
+    </a>
+  ),
+}));
+
+describe('InlineLink', () => {
+  test('renders as a normal link by default', () => {
+    render(<InlineLink href='/posts'>Posts</InlineLink>);
+
+    const link = screen.getByRole('link', { name: 'Posts' });
+    expect(link).toHaveAttribute('href', '/posts');
+    expect(link).not.toHaveAttribute('target', '_blank');
+  });
+
+  test('sets target blank when blank prop is true', () => {
+    render(
+      <InlineLink href='https://example.com' blank>
+        External
+      </InlineLink>,
+    );
+
+    const link = screen.getByRole('link', { name: 'External' });
+    expect(link).toHaveAttribute('href', 'https://example.com');
+    expect(link).toHaveAttribute('target', '_blank');
+  });
+});
-- 
cgit v1.2.3

