LibreChat/client/src/utils/__tests__
Danny Avila 611a1ef5dc
🏖️ fix: Sandpack ExternalResources for Static HTML Artifact Previews (#12509)
* fix: omit externalResources for static Sandpack previews

The Tailwind CDN URL lacks a file extension, causing Sandpack's
static template to throw a runtime injection error. Static previews
already load Tailwind via a script tag in the shared index.html,
so externalResources is unnecessary for them.

Closes #12507

* refactor: extract buildSandpackOptions and add tests

- Surgically omit only externalResources for static templates
  instead of discarding all sharedOptions, preventing future
  regression if new template-agnostic options are added.
- Extract options logic into a pure, testable helper function.
- Add unit tests covering all template/config combinations.

* chore: fix import order and pin test assertions

* fix: use URL fragment hint instead of omitting externalResources

Sandpack's static template regex detects resource type from the URL's
last file extension. The versioned CDN path (/3.4.17) matched ".17"
instead of ".js", throwing "Unable to determine file type". Rather
than omitting externalResources for static templates (which would
remove the only Tailwind injection path for HTML artifacts that don't
embed their own script tag), append a #tailwind.js fragment hint so
the regex matches ".js". Fragments are not sent to the server, so
the CDN response is unchanged.
2026-04-01 22:06:42 -04:00
..
agents.spec.tsx 📌 feat: Pin Agents and Models in the Sidebar (#10634) 2025-12-11 16:38:20 -05:00
applyModelSpecEphemeralAgent.test.ts 🗂️ refactor: Artifacts via Model Specs & Scope Badge Persistence by Spec Context (#11796) 2026-02-14 13:56:50 -05:00
artifacts.test.ts 🏖️ fix: Sandpack ExternalResources for Static HTML Artifact Previews (#12509) 2026-04-01 22:06:42 -04:00
buildDefaultConvo.test.ts 🎭 feat: Override Custom Endpoint Schema with Specified Params Endpoint (#11788) 2026-02-13 23:04:51 -05:00
citations.test.ts 📑 refactor: File Search Citations Dual-Format Unicode Handling (#10888) 2025-12-10 13:25:56 -05:00
cleanupPreset.integration.test.ts 🎭 feat: Override Custom Endpoint Schema with Specified Params Endpoint (#11788) 2026-02-13 23:04:51 -05:00
cleanupPreset.test.ts 🎭 feat: Override Custom Endpoint Schema with Specified Params Endpoint (#11788) 2026-02-13 23:04:51 -05:00
collection.test.ts 📁 refactor: Prompts UI (#11570) 2026-03-22 16:56:22 -04:00
imageResize.test.ts 🖼️ feat: Add Optional Client-Side Image Resizing to Prevent Upload Errors (#7909) 2025-06-24 10:43:29 -04:00
markdown.test.ts ⛓️💥 fix: Replace React Markdown Artifact Renderer with Static HTML (#12337) 2026-03-20 13:31:08 -04:00
mergeQuerySettingsWithSpec.test.ts 🏷️ fix: Clear ModelSpec Display Fields When Navigating via Agent Share Link (#12274) 2026-03-17 02:12:34 -04:00
mermaid.test.ts 🌗 refactor: Consistent Mermaid Theming for Inline and Artifact Renderers (#12055) 2026-03-04 09:28:19 -05:00
messages.test.ts 🗣️ a11y: Distinguish Conversation Headings for Screen Readers (#12341) 2026-03-20 16:50:12 -04:00
presets.test.ts 🏷️ refactor: EditPresetDialog UI and Remove chatGptLabel from Presets (#7543) 2025-05-24 19:24:42 -04:00
promptGroups.test.ts 📁 refactor: Prompts UI (#11570) 2026-03-22 16:56:22 -04:00
redirect.test.ts 🔒 fix: Request interceptor for Shared Link Page Scenarios (#12036) 2026-03-03 12:03:33 -05:00
scaleImage.test.ts 🧩 feat: Redesign Tool Call UI with Contextual Icons, Smart Grouping, and Rich Output Rendering (#12163) 2026-03-25 12:31:39 -04:00
share.test.ts 🔗 fix: Share Links Respect Custom Base Path (#11087) 2025-12-24 17:59:40 -05:00
timestamps.test.ts 👻 refactor: LocalStorage Cleanup and MCP State Optimization (#9528) 2025-09-09 17:32:10 -04:00
validateFiles.spec.ts 📎 fix: Enforce File Count and Size Limits Across All Attachment Paths (#12239) 2026-03-15 10:39:42 -04:00