Skip to content

test(sankey): add tests for special characters in node names#7545

Open
cyphercodes wants to merge 3 commits intomermaid-js:developfrom
cyphercodes:fix/sankey-special-characters-test
Open

test(sankey): add tests for special characters in node names#7545
cyphercodes wants to merge 3 commits intomermaid-js:developfrom
cyphercodes:fix/sankey-special-characters-test

Conversation

@cyphercodes
Copy link
Copy Markdown

Summary

This PR adds explicit test cases for special characters in Sankey diagram node names to verify and document support for these characters.

Related Issue

Fixes #7528 - Sankey Diagram Parsing Failure: Special Characters in Node Names Trigger "Syntax error in text"

Changes

  • Added two new test cases in sankey.spec.ts:
    • 'handles special characters in node names with sankey-beta syntax'
    • 'handles special characters in node names with sankey syntax'

Test Coverage

The tests verify that the following special characters are correctly parsed in node names:

  • Single quotes: Agricultural 'waste'
  • Ampersands: Lighting & appliances
  • Forward slashes: Over generation / exports
  • Hyphens: Heating and cooling - homes

Verification

The tests confirm that the parser already correctly handles these characters. The issue reported in #7528 appears to have been resolved in the current version (v11.13.0).

Checklist

  • Tests added for new functionality
  • All existing tests pass
  • Code follows project style guidelines (linting passed)

Add explicit test cases for special characters (single quotes, ampersands,
forward slashes, and hyphens) in Sankey diagram node names.

These tests verify the fix for issue mermaid-js#7528 where special characters in
node names like 'Agricultural \'waste\'', 'Lighting & appliances', and
'Over generation / exports' are correctly parsed.

The tests confirm that both 'sankey' and 'sankey-beta' syntax properly
handle these characters in CSV-style diagram definitions.
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit ec32396
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/69cce6fbaade0700084ed935
😎 Deploy Preview https://deploy-preview-7545--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 29, 2026

⚠️ No Changeset found

Latest commit: a50b583

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the Type: Bug / Error Something isn't working or is incorrect label Mar 29, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 29, 2026

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/@mermaid-js/examples@7545

mermaid

npm i https://pkg.pr.new/mermaid@7545

@mermaid-js/layout-elk

npm i https://pkg.pr.new/@mermaid-js/layout-elk@7545

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/@mermaid-js/layout-tidy-tree@7545

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/@mermaid-js/mermaid-zenuml@7545

@mermaid-js/parser

npm i https://pkg.pr.new/@mermaid-js/parser@7545

@mermaid-js/tiny

npm i https://pkg.pr.new/@mermaid-js/tiny@7545

commit: ec32396

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.34%. Comparing base (701020c) to head (ec32396).

Files with missing lines Patch % Lines
...d/src/rendering-util/rendering-elements/markers.js 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #7545   +/-   ##
=======================================
  Coverage     3.34%   3.34%           
=======================================
  Files          524     524           
  Lines        55309   55309           
  Branches       795     795           
=======================================
  Hits          1850    1850           
  Misses       53459   53459           
Flag Coverage Δ
unit 3.34% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...d/src/rendering-util/rendering-elements/markers.js 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link
Copy Markdown

argos-ci bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 2 changed Apr 1, 2026, 10:11 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug / Error Something isn't working or is incorrect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sankey Diagram Parsing Failure: Special Characters in Node Names Trigger "Syntax error in text" (v11.12.1)

2 participants