11import { describe , expect , it } from 'vitest'
2- import { toCopyableMarkdown } from '@/app/workspace/[workspaceId]/components/message-actions/message-actions '
2+ import { toCopyableMarkdown } from '@/app/workspace/[workspaceId]/home/ components/mothership-chat/copyable-markdown '
33
44describe ( 'toCopyableMarkdown' , ( ) => {
55 it ( 'preserves message Markdown, including fenced code and its language' , ( ) => {
@@ -23,12 +23,25 @@ describe('toCopyableMarkdown', () => {
2323 it ( 'removes internal structured tags without flattening surrounding Markdown' , ( ) => {
2424 const message = [
2525 'Before **formatted text**.' ,
26- '<credential>remove this UI payload </credential>' ,
26+ '<credential>{"type":"service_account","provider":"gmail"} </credential>' ,
2727 'After [a link](https://example.com).' ,
2828 ] . join ( '\n' )
2929
3030 expect ( toCopyableMarkdown ( message ) ) . toBe (
3131 [ 'Before **formatted text**.' , '' , 'After [a link](https://example.com).' ] . join ( '\n' )
3232 )
3333 } )
34+
35+ it ( 'preserves tag-shaped text that the chat renders literally' , ( ) => {
36+ const message = [
37+ 'Document `<credential>example</credential>`.' ,
38+ '' ,
39+ '```html' ,
40+ '<file>example</file>' ,
41+ '<question>example</question>' ,
42+ '```' ,
43+ ] . join ( '\n' )
44+
45+ expect ( toCopyableMarkdown ( message ) ) . toBe ( message )
46+ } )
3447} )
0 commit comments