fix(titleCase): insert extra space when convert valid string#97
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 340 409 +69
Branches 39 45 +6
=========================================
+ Hits 340 409 +69 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
| ["foo", "Foo"], | ||
| ["foo-bar", "Foo Bar"], | ||
| ["this-IS-aTitle", "This is a Title"], | ||
| ["Foo Bar", "Foo Bar"], |
There was a problem hiding this comment.
Maybe add at least to types test as well? (for types we can do simply similar fix with trim should be fine)
There was a problem hiding this comment.
I made some changes to types and added types test cases for TrainCase and TitleCase(TrainCase with space joiner).
There are still two cases didn't pass. That's because titleCase and trainCase use filter(Boolean) to filter empty string. I don't know how to fix the type properly so I add a @ts-expect-error comment above it.
Could you do some help?
5afdbbb to
80248aa
Compare
80248aa to
a9cbd9a
Compare
| // Case rising edge | ||
| if (previousUpper === false && isUpper === true) { | ||
| parts.push(buff); | ||
| parts.push(buff.trim()); |
There was a problem hiding this comment.
I'm wondering if we could fix algorithm that does not add trailing space in first place?
There was a problem hiding this comment.
is this actually just that " " should be a splitter?
then we will skip over it like other splitters
edit: solved by #98 it seems. so we should land that and remove the trim here (if this PR is needed anymore)
This PR resolves #96 and adds test cases for other converters while convert valid string.