Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update toCamelCase #290

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

cailborg
Copy link

Checks for existing camelCase before applying a conversion
Screenshot 2023-10-31 at 10 48 38 am
OUTPUT

"interactiveSubtle": {
         "type": "color",
         "value": "{palette.eggplant.300}"
       },
       ```

@coveralls
Copy link

coveralls commented Oct 31, 2023

Pull Request Test Coverage Report for Build 6739879734

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 2 of 3 (66.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.09%) to 66.346%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/utilities/transformName.ts 2 3 66.67%
Totals Coverage Status
Change from base Build 6474855251: -0.09%
Covered Lines: 497
Relevant Lines: 732

💛 - Coveralls

@lukasoppermann
Copy link
Owner

Hey, thank you for the PR.

I think we should make sure that it does also work if there are numbers in the name, what do you think?

@cailborg
Copy link
Author

cailborg commented Nov 3, 2023

No worries, should work with numbers now.
Input:
Screenshot 2023-11-03 at 11 40 11 am
Output:
Screenshot 2023-11-03 at 11 40 22 am

@lukasoppermann
Copy link
Owner

Hey, sadly with the change to the function we run into issues so that the test does not pass anymore:

Use npx jest transformName to run the test locally.

FAIL tests/unit/transformName.test.ts
transformName
✓ default case (1 ms)
✕ camelCase (3 ms)
✓ kebab-case

● transformName › camelCase

expect(received).toStrictEqual(expected) // deep equality

- Expected  - 6
+ Received  + 6

  Array [
-   "fooBar",
-   "fooBar",
-   "fooBar",
-   "foo123bar",
+   " FooBar",
+   "-fooBar",
+   "_FOOBAR",
+   "foo123Bar",
    "fooBar",
    "fooBarFooBarFooBarFooBar",
-   "equipmentclassName",
-   "equipmentClassname",
+   "equipmentClassName",
    "equipmentClassName",
    "equipmentClassName",
+   " EquipmentClassName",
  ]

  35 |   test('camelCase', () => {
  36 |     const transformed = strings.map(string => transformName(string, 'camelCase'))
> 37 |     expect(transformed).toStrictEqual([
     |                         ^
  38 |       'fooBar',
  39 |       'fooBar',
  40 |       'fooBar',

@lukasoppermann
Copy link
Owner

Hey @cailborg would you be able to update this so we can merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants