Skip to content

Commit 893b026

Browse files
committed
Syntax fixes in markdown test helpers
1 parent 8417376 commit 893b026

6 files changed

Lines changed: 64 additions & 4 deletions

File tree

‎src/lib/markdown/README.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Working plugins that pass all tests:
7171
- rehype-autolink-headings
7272
- rehype-tailwind-classes
7373

74+
### Rehype Tailwind Classes
75+
7476
Conditional elements (have checks):
7577

7678
- a (checks for .btn and .heading-anchor)
@@ -81,6 +83,45 @@ Conditional elements (have checks):
8183
- iframe
8284
- various special cases
8385

86+
### Duplicate test code across units, units_with_default_astro, and e2e
87+
88+
- rehypeAccessibleEmojis.spec.tsx
89+
90+
Summary: What Should Change
91+
92+
Remove:
93+
94+
Layer 2: "should use custom footnote labels from Astro config" test (doesn't test emojis)
95+
96+
Add to Layer 2 (Astro):
97+
98+
Test emoji shortcodes (:heart:) in addition to Unicode
99+
"Text without emojis" edge case
100+
DOM-based validation with axe (optional, but valuable)
101+
Empty aria-label verification
102+
103+
Add to Layer 4 (E2E):
104+
105+
Unicode emoji tests in addition to shortcodes
106+
"Text without emojis" edge case
107+
Expand emoji.md fixture to include more edge cases
108+
109+
Keep Layer 1 (Units) as-is:
110+
111+
It's focused and tests the isolated plugin correctly
112+
Uses Unicode emojis which is appropriate
113+
Has good edge case coverage
114+
115+
Fixture Enhancement Needed
116+
117+
The emoji.md fixture should include:
118+
119+
Unicode emojis (not just shortcodes)
120+
Text without emojis
121+
Emoji in headings
122+
Emoji in various list types
123+
More diverse emoji types
124+
84125
## Markdown Config Updates
85126

86127
Details/Summary elements - These HTML elements aren't being processed by remarkGfm (they need to be raw HTML)

‎src/lib/markdown/__tests__/e2e/__fixtures__/attribution.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Attribution Test
33
---
44

5+
<!-- markdownlint-disable -->
56
# Attribution Feature Test
67

78
> That's one small step for man, one giant leap for mankind.

‎src/lib/markdown/helpers/index.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Barrel file for markdown helper utilities
3+
*
4+
* This module re-exports all helper functions for markdown processing,
5+
* fixture loading, and test utilities.
6+
*/
7+
8+
// Markdown fixture loader utilities for E2E testing
9+
export { loadFixture, MarkdownOutput, renderFixture, renderMarkdown } from './markdownLoader'
10+
11+
// Markdown pipeline processor for testing
12+
export { renderMarkdown as processMarkdownPipeline } from './pipeline'
13+
14+
// Test utilities for different pipeline layers
15+
export { processIsolated, processWithAstroSettings, processWithFullPipeline } from './test-utils'

‎src/lib/markdown/helpers/pipeline.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import remarkGfm from 'remark-gfm'
1313
import remarkRehype from 'remark-rehype'
1414
import rehypeStringify from 'rehype-stringify'
1515
import rehypeSlug from 'rehype-slug'
16-
import { markdownConfig } from '../../config/markdown'
16+
import { markdownConfig } from '@lib/config/markdown'
1717

1818
/**
1919
* Renders markdown content through the complete Astro pipeline

‎src/lib/markdown/helpers/test-utils.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export async function processIsolated(
2323
processor.use(plugin)
2424
}
2525

26-
const result = await processor.use(remarkRehype).use(rehypeStringify).process(markdown)
26+
const result = await processor
27+
.use(remarkRehype)
28+
.use(rehypeStringify)
29+
.process(markdown)
2730

2831
return String(result)
2932
}

‎src/lib/markdown/plugins/rehype-tailwind/__tests__/html.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { describe, expect, test } from 'vitest'
22
import type { Element } from 'hast'
3-
import type { ElementConfig } from '../@types/index.js'
3+
import type { ElementConfig } from '../@types/index'
44
import {
55
htmlElements,
66
applyHtmlElementClasses,
77
isSimpleHtmlElement,
88
getElementConfig,
9-
} from '../visitors/simple.js'
9+
} from '../visitors/simple'
1010

1111
describe('htmlElements configuration', () => {
1212
test('contains expected number of element configurations', () => {

0 commit comments

Comments
 (0)