mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix: add missing test case and fix double semicolon in screaming snake case challenge (#66458)
Some checks failed
CI - E2E - 3rd party donation tests / Build Client (24) (push) Has been cancelled
CI - E2E - 3rd party donation tests / Build API (Container) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - E2E - 3rd party donation tests / Run Playwright 3rd Party Donation Tests (chromium, 24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
Some checks failed
CI - E2E - 3rd party donation tests / Build Client (24) (push) Has been cancelled
CI - E2E - 3rd party donation tests / Build API (Container) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - E2E - 3rd party donation tests / Run Playwright 3rd Party Donation Tests (chromium, 24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
This commit is contained in:
parent
da0eea689e
commit
0fc80621fb
@ -55,6 +55,12 @@ assert.equal(toScreamingSnakeCase("user-address"), "USER_ADDRESS");
|
||||
assert.equal(toScreamingSnakeCase("username"), "USERNAME");
|
||||
```
|
||||
|
||||
`toScreamingSnakeCase("my_variable_name")` should return `"MY_VARIABLE_NAME"`.
|
||||
|
||||
```js
|
||||
assert.equal(toScreamingSnakeCase("my_variable_name"), "MY_VARIABLE_NAME");
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
@ -73,6 +79,6 @@ function toScreamingSnakeCase(variableName) {
|
||||
let temp = variableName.replace(/[-_]+/g, ' ');
|
||||
temp = temp.replace(/([a-z0-9])([A-Z])/g, '$1 $2');
|
||||
const words = temp.trim().split(/\s+/);
|
||||
return words.join('_').toUpperCase();;
|
||||
return words.join('_').toUpperCase();
|
||||
}
|
||||
```
|
||||
|
||||
@ -70,6 +70,15 @@ TestCase().assertEqual(to_screaming_snake_case("username"), "USERNAME")`)
|
||||
}})
|
||||
```
|
||||
|
||||
`to_screaming_snake_case("my_variable_name")` should return `"MY_VARIABLE_NAME"`.
|
||||
|
||||
```js
|
||||
({test: () => { runPython(`
|
||||
from unittest import TestCase
|
||||
TestCase().assertEqual(to_screaming_snake_case("my_variable_name"), "MY_VARIABLE_NAME")`)
|
||||
}})
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user