Giter Site home page Giter Site logo

Comments (3)

tikaro avatar tikaro commented on June 28, 2024 1

TL:DR; SleeplessByte is correct; I had a stale spec file and didn't know it.

Aha! I see that you changed the test suite ten days ago in PR#649:
exercism/javascript#649

Previously, the spec used an intermediate variable:

const name = '';
expect(twoFer(name)).toEqual("One for you, one for me.")

...which passes '' to twoFer. Since there is a value present (a blank one), the default value is not triggered.

Now, the spec is:

expect(twoFer()).toEqual("One for you, one for me."

...which passes nothing/undefined to twoFer, and so the default value is triggered.

I had gotten it into my head that the "default value" solution was working for the regular function, but not for the arrow function. But I can't reproduce that behavior now; if I re-test with the older version of the spec, both the "regular" flavor and "arrow" flavor fail, as expected.

So this is definitely an issue caused by me running a stale spec.

Normally, I would depend on Git to tell me whether my local files were stale or not, but in this case since we're using a CLI instead of git, I don't have that guardrail. I'll need to remember to make sure that my specs are up to date before getting further into the weeds on language issues :)

Thanks very much for the rapid input, @SleeplessByte !

from website-copy.

SleeplessByte avatar SleeplessByte commented on June 28, 2024 1

A quick sanity check is to first check your solution page at the bottom for a message that it's outdated. If it's not, then at least in the system you're working against the latest first. Now check the test stuite tab. If it doesn't match your local file, you're probably using something outdated locally and need to download again!

from website-copy.

SleeplessByte avatar SleeplessByte commented on June 28, 2024

Default values always work.

Your test suite is likely outdated (and it's passing in '' instead of "nothing/undefined).

from website-copy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.