Skip to content

Commit cdc74ef

Browse files
IdrisGitghostdevv
authored andcommitted
test: add a simple test
1 parent 5c3d5ea commit cdc74ef

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/unit/server/utils/readme.spec.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,42 @@ describe('Playground Link Extraction', () => {
142142
expect(result.playgroundLinks).toHaveLength(1)
143143
expect(result.playgroundLinks[0]!.provider).toBe('stackblitz')
144144
})
145+
146+
it('returns raw markdown content', async () => {
147+
const markdown = `# Test Package
148+
149+
## Installation
150+
151+
\`\`\`bash
152+
npm install test-package
153+
\`\`\`
154+
155+
## Usage
156+
157+
This is a sample package for testing.
158+
159+
> [!NOTE]
160+
> This is a note callout.
161+
162+
- Feature one
163+
- Feature two
164+
`
165+
const result = await renderReadmeHtml(markdown, 'test-pkg')
166+
167+
expect(result.markdown).toBe(markdown)
168+
expect(result.markdown).toContain('# Test Package')
169+
expect(result.markdown).toContain('## Installation')
170+
expect(result.markdown).toContain('npm install test-package')
171+
})
172+
173+
it('returns empty string for empty content', async () => {
174+
const result = await renderReadmeHtml('', 'test-pkg')
175+
176+
expect(result.markdown).toBe('')
177+
expect(result.html).toBe('')
178+
expect(result.playgroundLinks).toEqual([])
179+
expect(result.toc).toEqual([])
180+
})
145181
})
146182
})
147183

0 commit comments

Comments
 (0)