mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 21:31:46 +00:00
de157cb87b
Server (172 tests): - journeyService unit tests (87 tests): CRUD, access control, sync, photos, contributors - journeyShareService unit tests (20 tests): share links, token validation, public access - journey integration tests (45 tests): all API routes, auth, permissions, edge cases - Test helpers: journey factories, RESET_TABLES updated Client (340+ tests): - journeyStore tests (15 tests): all store actions and state management - JourneyPage tests (20 tests): frontpage, create flow, suggestions, navigation - JourneyDetailPage tests (94 tests): all sub-components, entry editor, settings, share links, contributors, gallery, map, trip linking - JourneyPublicPage tests (18 tests): public view, tabs, restricted access - JourneyBookPDF tests (6 tests): PDF generation - BottomNav tests (9 tests): profile sheet, navigation - PhotoLightbox tests (8 tests): keyboard nav, counter - JourneyMap tests (12 tests): markers, polylines, zoom - Component tests: moodConfig, stripMarkdown, MarkdownToolbar, JournalBody, MobileTopHeader - DashboardPage tests (32 tests): spotlight card, quick actions, widget settings SonarQube: exclude unused MemoriesPanel from coverage (dead code, moved to Journey)
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
// FE-UTIL-STRIPMD-001 to FE-UTIL-STRIPMD-006
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
import { stripMarkdown } from './stripMarkdown';
|
|
|
|
describe('stripMarkdown', () => {
|
|
it('FE-UTIL-STRIPMD-001: strips bold and italic formatting', () => {
|
|
expect(stripMarkdown('**bold** and _italic_')).toBe('bold and italic');
|
|
expect(stripMarkdown('__also bold__ and *also italic*')).toBe('also bold and also italic');
|
|
});
|
|
|
|
it('FE-UTIL-STRIPMD-002: strips headings', () => {
|
|
expect(stripMarkdown('# Heading 1')).toBe('Heading 1');
|
|
expect(stripMarkdown('## Heading 2')).toBe('Heading 2');
|
|
expect(stripMarkdown('### Heading 3')).toBe('Heading 3');
|
|
});
|
|
|
|
it('FE-UTIL-STRIPMD-003: converts links to text and removes images', () => {
|
|
expect(stripMarkdown('[click here](https://example.com)')).toBe('click here');
|
|
expect(stripMarkdown('')).toBe('');
|
|
});
|
|
|
|
it('FE-UTIL-STRIPMD-004: strips code blocks and inline code', () => {
|
|
expect(stripMarkdown('use `console.log`')).toBe('use console.log');
|
|
expect(stripMarkdown('```\ncode block\n```')).toBe('');
|
|
});
|
|
|
|
it('FE-UTIL-STRIPMD-005: strips blockquotes and lists', () => {
|
|
expect(stripMarkdown('> quoted text')).toBe('quoted text');
|
|
expect(stripMarkdown('- item one')).toBe('item one');
|
|
expect(stripMarkdown('1. first item')).toBe('first item');
|
|
});
|
|
|
|
it('FE-UTIL-STRIPMD-006: strips strikethrough and horizontal rules', () => {
|
|
expect(stripMarkdown('~~deleted~~')).toBe('deleted');
|
|
expect(stripMarkdown('---')).toBe('');
|
|
});
|
|
});
|