forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #491 from dustinwloring1988/stable-additions
Stable additions
- Loading branch information
Showing
15 changed files
with
28,537 additions
and
2,858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { stripCodeFenceFromArtifact } from './Markdown'; | ||
|
||
describe('stripCodeFenceFromArtifact', () => { | ||
it('should remove code fences around artifact element', () => { | ||
const input = "```xml\n<div class='__boltArtifact__'></div>\n```"; | ||
const expected = "\n<div class='__boltArtifact__'></div>\n"; | ||
expect(stripCodeFenceFromArtifact(input)).toBe(expected); | ||
}); | ||
|
||
it('should handle code fence with language specification', () => { | ||
const input = "```typescript\n<div class='__boltArtifact__'></div>\n```"; | ||
const expected = "\n<div class='__boltArtifact__'></div>\n"; | ||
expect(stripCodeFenceFromArtifact(input)).toBe(expected); | ||
}); | ||
|
||
it('should not modify content without artifacts', () => { | ||
const input = '```\nregular code block\n```'; | ||
expect(stripCodeFenceFromArtifact(input)).toBe(input); | ||
}); | ||
|
||
it('should handle empty input', () => { | ||
expect(stripCodeFenceFromArtifact('')).toBe(''); | ||
}); | ||
|
||
it('should handle artifact without code fences', () => { | ||
const input = "<div class='__boltArtifact__'></div>"; | ||
expect(stripCodeFenceFromArtifact(input)).toBe(input); | ||
}); | ||
|
||
it('should handle multiple artifacts but only remove fences around them', () => { | ||
const input = [ | ||
'Some text', | ||
'```typescript', | ||
"<div class='__boltArtifact__'></div>", | ||
'```', | ||
'```', | ||
'regular code', | ||
'```', | ||
].join('\n'); | ||
|
||
const expected = ['Some text', '', "<div class='__boltArtifact__'></div>", '', '```', 'regular code', '```'].join( | ||
'\n', | ||
); | ||
|
||
expect(stripCodeFenceFromArtifact(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.