emma-hermes/apps/desktop/src/lib/markdown-code.test.ts

24 lines
696 B
TypeScript

import { describe, expect, it } from 'vitest'
import { isLikelyProseCodeBlock } from './markdown-code'
describe('isLikelyProseCodeBlock', () => {
it('detects prose that Streamdown mislabels as an unknown language', () => {
expect(
isLikelyProseCodeBlock(
'heads',
[
'- Pure white (`#ffffff`), roughness 0.55, no emissive',
'- Black wireframe edges at 35% opacity',
'',
'Want the bunny gone, or want me to keep riffing on it?'
].join('\n')
)
).toBe(true)
})
it('keeps real code blocks', () => {
expect(isLikelyProseCodeBlock('ts', 'const value = { bunny: true };\nreturn value')).toBe(false)
})
})