Skip to content

test(svg sanitizer): verify sanitizeSpeed handles decimal integer strings like '8.0s' #735

@JhaSourav07

Description

@JhaSourav07

🧩 Background

sanitizeSpeed uses regex ^(\d+(\.\d+)?)s$. The string '8.0s' matches but the existing tests don't cover it.

🎯 Objective

Add edge-case tests for sanitizeSpeed with decimal values in range.

📁 Files to touch

  • lib/svg/sanitizer.test.ts

🛠️ Implementation steps

  • Test sanitizeSpeed('8.0s', '5s')'8.0s' (valid, in range).
  • Test sanitizeSpeed('2.0s', '5s')'2.0s' (boundary).
  • Test sanitizeSpeed('20.0s', '5s')'20.0s' (boundary).
  • Test sanitizeSpeed('2.1s', '5s')'2.1s' (valid decimal).

✅ Definition of done

  • 4 test cases.
  • All existing sanitizer tests pass.

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions