Git Product home page Git Product logo

Comments (7)

fsoikin avatar fsoikin commented on June 20, 2024

This is the right way. You're just using newer package set than Spec was last modified against.

from purescript-spec.

tonicebrian avatar tonicebrian commented on June 20, 2024

So, is it a matter of you releasing a new version to regisitry? I don't get what would be the solution to this.

from purescript-spec.

fsoikin avatar fsoikin commented on June 20, 2024

Yes, exactly, it's a matter of releasing a new version.

from purescript-spec.

tonicebrian avatar tonicebrian commented on June 20, 2024

Looking forward to it then. Thanks!!

from purescript-spec.

fsoikin avatar fsoikin commented on June 20, 2024

Actually, on closer inspection, it appears there is something fishy with your code. The Spec type doesn't touch Map in any way, and the only place Map is used in this library at all is in the reporters, which don't come into play at the stage of defining test cases.

Where do you import that Spec type from?

from purescript-spec.

tonicebrian avatar tonicebrian commented on June 20, 2024

I think I was able to track down the problem but still no clue on why it warns on the Spec. First I import spec using:

import Test.Spec (describe, it, Spec)
import Test.Spec.Assertions (fail, shouldEqual)

Then I have a test that is record with a field that is a Map of Maps. Having it here as reference:

          , techTrack:
              M.fromFoldable
                [ Tuple GermanEmpire (M.fromFoldable [ Tuple Box1 [ Just Offensive ] ])
                , Tuple FrancoBritishEmpire (M.fromFoldable [ Tuple Box2 [ Nothing ] ])
                , Tuple AustroHungarianEmpire mempty
                , Tuple RussianEmpire mempty
                ]

The last 2 lines are the culprits. When I use mempty as in haskell I get the Spec Unit warning. If I change it to M.empty the problem goes away.

If it is of any help, the assertions are sequenced because I didn't want a single test for big nested data structure:

      case parseJson golden >>= decodeJson of
        Left e -> fail ("Couldn't deserialize the golden file: " <> printJsonDecodeError e)
        Right (UpdateGameState obtained) -> do
          obtained.victoryPoints `shouldEqual` expected.victoryPoints
          obtained.techTrack `shouldEqual` expected.techTrack
          obtained.missionsTrack `shouldEqual` expected.missionsTrack
          obtained.turn `shouldEqual` expected.turn
          obtained.counters `shouldEqual` expected.counters
          obtained.areaControl `shouldEqual` expected.areaControl
        Right _ -> fail ("The BEMsg in the file is not an UpdateGameState")

Does it sound a ring on you?

from purescript-spec.

fsoikin avatar fsoikin commented on June 20, 2024

Well yes, that sounds exactly right: you're using mempty for a Map, so you're using the Monoid Map instance, and that's what gives you a warning.

from purescript-spec.

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.