Spinal Tap Case - bug in test?

Tell us what’s happening:

Hi, my code pass all tests except third ( spinalCase("The_Andy_Griffith_Show") ) but somehow in output i see diffrent test: spinalCase("The_Andy_<wbr>Griffith_Show") should return "the-andy-griffith-show".

So it is bug? Or i need to make function and for that case ( "The_Andy_<wbr>Griffith_Show") ?

Your code so far

function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. Hubbins
  return str.split(/(?=[A-Z_])|\W/).join("-").toLowerCase();
}

spinalCase("The_Andy_Griffith_Show");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case

1 Like

Looks like your output on my computer is

the-_-andy-_-griffith-_-show instead of the-andy-griffith-show

So you will need to fix your regex.

that <wbr> has been popping up in a few different test sets. Saw two questions about it last night. If ever you see that in the expected output, assume that it ain’t supposed to be there.

Yeah, it’s a bug, got introduced recently I think. If you feel so inclined, stretch your github skills and file a bug report about it! :slight_smile:

@snowmonkey Do you happen to have a list of challenges where you are seeing <wbr> show in the tests? I will create an issue for this if you have a list of other such challenges.

I will keep digging, I could have sworn it was a post I’d commented on yesterday, but now my eyeballs hurt from looking through my history. It was a simple string output thing, and the failure message in the console included the <wbr>. If I find it (or any others) I’ll pm them to you.

I found them actually and have created an issue on Github. I have not been as active on the forum lately, but have been heavily involved on the Github side of things since October. If you see the same issue pop up on the forum 2-3 times, send me a note with a reference to threads and I will dig deeper and create an issue ticket if needed.

Note: During the time I started writing this response, I already received feedback that this bug has been resolved and is just waiting for deployment to production.

1 Like

Thank you. I was worried I’d lost my mind. precog nightmares and stuff. :wink:

U were right. Thanks