diff --git a/package-lock.json b/package-lock.json index c9d7d799..c4a01228 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,7 @@ "@milkdown/react": "^7.20.0", "@milkdown/utils": "^7.20.0", "@nostrify/nostrify": "^0.51.1", - "@nostrify/react": "^0.4.1", + "@nostrify/react": "^0.5.0", "@nostrify/types": "^0.36.9", "@plausible-analytics/tracker": "^0.4.4", "@radix-ui/react-accordion": "^1.2.0", @@ -2527,9 +2527,9 @@ "license": "MIT" }, "node_modules/@nostrify/react": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@nostrify/react/-/react-0.4.1.tgz", - "integrity": "sha512-2JXxEl4e6FIFhbi96Dwv2knu5qAACYulo1a0oVell/aS8KCWsBTPd1+v0EUra0yqiUA3Q1nVLrk8mx7kQYH/yQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@nostrify/react/-/react-0.5.0.tgz", + "integrity": "sha512-IQf74SSusSIyhI9FkUQSUTsX20yeww5xHIUeexvxcWXEpVhYJYCwduK2yRB75NvYgXjcqYeDUGA2RvzBhDc/eA==", "dependencies": { "@nostrify/nostrify": "0.51.1", "@nostrify/types": "0.36.9" diff --git a/package.json b/package.json index 118bb680..0b27f9c6 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@milkdown/react": "^7.20.0", "@milkdown/utils": "^7.20.0", "@nostrify/nostrify": "^0.51.1", - "@nostrify/react": "^0.4.1", + "@nostrify/react": "^0.5.0", "@nostrify/types": "^0.36.9", "@plausible-analytics/tracker": "^0.4.4", "@radix-ui/react-accordion": "^1.2.0", diff --git a/src/components/NoteContent.test.tsx b/src/components/NoteContent.test.tsx index cdf9fc47..03218171 100644 --- a/src/components/NoteContent.test.tsx +++ b/src/components/NoteContent.test.tsx @@ -5,7 +5,7 @@ import { NoteContent } from './NoteContent'; import type { NostrEvent } from '@nostrify/nostrify'; describe('NoteContent', () => { - it('linkifies URLs in kind 1 events', () => { + it('linkifies URLs in kind 1 events', async () => { const event: NostrEvent = { id: 'test-id', pubkey: 'test-pubkey', @@ -22,13 +22,13 @@ describe('NoteContent', () => { ); - const link = screen.getByRole('link', { name: 'https://example.com' }); + const link = await screen.findByRole('link', { name: 'https://example.com' }); expect(link).toBeInTheDocument(); expect(link).toHaveAttribute('href', 'https://example.com'); expect(link).toHaveAttribute('target', '_blank'); }); - it('linkifies URLs in kind 1111 events (comments)', () => { + it('linkifies URLs in kind 1111 events (comments)', async () => { const event: NostrEvent = { id: 'test-comment-id', pubkey: 'test-pubkey', @@ -49,13 +49,13 @@ describe('NoteContent', () => { ); - const link = screen.getByRole('link', { name: 'https://nostrbook.dev/kinds/1111' }); + const link = await screen.findByRole('link', { name: 'https://nostrbook.dev/kinds/1111' }); expect(link).toBeInTheDocument(); expect(link).toHaveAttribute('href', 'https://nostrbook.dev/kinds/1111'); expect(link).toHaveAttribute('target', '_blank'); }); - it('handles text without URLs correctly', () => { + it('handles text without URLs correctly', async () => { const event: NostrEvent = { id: 'test-id', pubkey: 'test-pubkey', @@ -72,11 +72,11 @@ describe('NoteContent', () => { ); - expect(screen.getByText('This is just plain text without any links.')).toBeInTheDocument(); + expect(await screen.findByText('This is just plain text without any links.')).toBeInTheDocument(); expect(screen.queryByRole('link')).not.toBeInTheDocument(); }); - it('renders hashtags as links', () => { + it('renders hashtags as links', async () => { const event: NostrEvent = { id: 'test-id', pubkey: 'test-pubkey', @@ -93,7 +93,7 @@ describe('NoteContent', () => { ); - const nostrHashtag = screen.getByRole('link', { name: '#nostr' }); + const nostrHashtag = await screen.findByRole('link', { name: '#nostr' }); const bitcoinHashtag = screen.getByRole('link', { name: '#bitcoin' }); expect(nostrHashtag).toBeInTheDocument(); @@ -102,7 +102,7 @@ describe('NoteContent', () => { expect(bitcoinHashtag).toHaveAttribute('href', '/t/bitcoin'); }); - it('generates deterministic names for users without metadata and styles them differently', () => { + it('generates deterministic names for users without metadata and styles them differently', async () => { // Use a valid npub for testing const event: NostrEvent = { id: 'test-id', @@ -121,7 +121,7 @@ describe('NoteContent', () => { ); // The mention should be rendered with a deterministic name - const mention = screen.getByRole('link'); + const mention = await screen.findByRole('link'); expect(mention).toBeInTheDocument(); // Should have muted styling for generated names (muted-foreground instead of primary) diff --git a/vite.config.ts b/vite.config.ts index 908c45f5..7f9a8533 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -176,6 +176,7 @@ export default defineConfig(({ mode }) => { alias: { "@": path.resolve(__dirname, "./src"), }, + dedupe: ['react', 'react-dom', 'react/jsx-runtime'], }, }; }); \ No newline at end of file