mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
test(desktop): add math-delimiter fixtures for the react-streamdown preprocess swap
lock the four behaviors the built-in normalizeMathDelimiters/escapeCurrencyDollars introduce over the deleted custom helpers: $$<digit>$$ display math stays intact, double-backslash brackets and [/math]/[/inline] tag pairs rewrite to dollar delimiters, and currency dollars in prose are escaped. the existing preprocessMarkdown suite had no math cases.
This commit is contained in:
parent
9eb89b8a12
commit
b50b83fbd8
1 changed files with 25 additions and 0 deletions
|
|
@ -210,4 +210,29 @@ describe('preprocessMarkdown', () => {
|
|||
|
||||
expect(() => preprocessMarkdown(input)).not.toThrow()
|
||||
})
|
||||
|
||||
it('keeps $$<digit>$$ display math intact instead of escaping it as currency', () => {
|
||||
const output = preprocessMarkdown('$$5x = 10$$')
|
||||
|
||||
expect(output).toContain('$$5x = 10$$')
|
||||
expect(output).not.toContain('\\$')
|
||||
})
|
||||
|
||||
it('rewrites double-backslash bracket math to dollar delimiters', () => {
|
||||
const output = preprocessMarkdown('\\\\(x^2\\\\)')
|
||||
|
||||
expect(output).toContain('$x^2$')
|
||||
})
|
||||
|
||||
it('rewrites [/math] and [/inline] tag pairs to dollar delimiters', () => {
|
||||
expect(preprocessMarkdown('[/math]a+b[/math]')).toContain('$$a+b$$')
|
||||
expect(preprocessMarkdown('[/inline]x[/inline]')).toContain('$x$')
|
||||
})
|
||||
|
||||
it('escapes currency dollars in prose so they are not parsed as math', () => {
|
||||
const output = preprocessMarkdown('$5 and $10')
|
||||
|
||||
expect(output).toContain('\\$5')
|
||||
expect(output).toContain('\\$10')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue