GithubHelp home page GithubHelp logo

request for help about elm HOT 6 CLOSED

exercism avatar exercism commented on July 21, 2024
request for help

from elm.

Comments (6)

tgecho avatar tgecho commented on July 21, 2024

There is actually already an Elm equivalent in the Time.now task (http://package.elm-lang.org/packages/elm-lang/core/latest/Time#now).

Unfortunately I'm not sure of the best way to incorporate such an Elm specific exercise.

from elm.

tgecho avatar tgecho commented on July 21, 2024

... didn't mean to post that quite yet, but I'll continue. :)

Adding the current time as a factor in unit tests makes them quite a bit messier (I'm not sure elm-test) even has provision for incorporation ports/subscriptions/etc. Usually you'd write unit tests against hard coded Time values so that your expected results can also be specified explicitly.

All that is to say that I'm not sure, but I suspect more advanced and Elm specific exercises probably need a home outside of Exercism :)

from elm.

rebelwarrior avatar rebelwarrior commented on July 21, 2024

from elm.

rebelwarrior avatar rebelwarrior commented on July 21, 2024

from elm.

tgecho avatar tgecho commented on July 21, 2024

That's correct, but in the end you'd have essentially the same thing: an incoming message from Elm's Time.now task or from a subscription to a port returning JS's Date.now(). I could be wrong, but I don't think elm-test has any way to incorporate these into a test suite.

I'm totally up for ideas! I'm not trying to say "no" (not really my call anyway ;) ), just that I'm not sure how it fits. I'd be curious to see if other tracks actually use the current date in their tests or if they simply hard code specific example tests.

from elm.

tgecho avatar tgecho commented on July 21, 2024

I'm sorry that I let this kinda fizzle out. I still think the most correct answer (from a general unit test perspective and an Exercism specific perspective) is to test a predefined set of dates.

I'm closing this to tidy things up. Please feel free to reopen if you want to go over anything else!

from elm.

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.