A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

at trunk 815 B View raw
1import { describe, expect, it } from 'vitest'; 2import { parseInlineCode } from './inline-code'; 3 4describe( 'parseInlineCode', () => { 5 it( 'splits a string into text and code segments', () => { 6 expect( parseInlineCode( 'fall back to `textContent` always' ) ).toEqual( [ 7 { text: 'fall back to ', code: false }, 8 { text: 'textContent', code: true }, 9 { text: ' always', code: false }, 10 ] ); 11 } ); 12 13 it( 'handles a code span at the start and end', () => { 14 expect( parseInlineCode( '`a` and `b`' ) ).toEqual( [ 15 { text: 'a', code: true }, 16 { text: ' and ', code: false }, 17 { text: 'b', code: true }, 18 ] ); 19 } ); 20 21 it( 'returns a single text segment when there are no backticks', () => { 22 expect( parseInlineCode( 'plain text' ) ).toEqual( [ 23 { text: 'plain text', code: false }, 24 ] ); 25 } ); 26} );