jeudi 21 juillet 2016

Mocha test, actual different from expected

I just started using Mocha and having the problem where the expected and the actual output are exactly the same but yet Mocha is saying they are different and failing the test.

This is the output and every string and space etc are shown to be the same:

C:\Users\owner\react\voting>npm run test

> react-hot-boilerplate@1.0.0 test C:\Users\owner\react\voting
> mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive



  application logic
    setEntries
      √ adds the entries to the state
    next
      √ takes the next two entries under vote
    vote
      √ creates a tally for the voted entry
      √ adds to existing tally for the voted entry
      1) removes the loser and places winner back in entries list
      2) places voted pair back to entries list

  immutability
    a number
      √ is immutable
    A List
      √ is immutable
    a tree
      √ is immutable


  7 passing (62ms)
  2 failing

  1) application logic vote removes the loser and places winner back in entries list:

      AssertionError: expected 'Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr DooLittle", "Trainspotting" ] }' to equal 'Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr Doolittle", "Trainspotting" ] }'
      + expected - actual

      -Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr DooLittle", "Trainspotting" ] }
      +Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr Doolittle", "Trainspotting" ] }



  2) application logic vote places voted pair back to entries list:

      AssertionError: expected 'Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr DooLittle", "Trainspotting", "28 Days Later" ] }' to equal 'Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr Doolittle", "Trainspotting", "28 Days Later" ] }'
      + expected - actual

      -Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr DooLittle", "Trainspotting", "28 Days Later" ] }
      +Map { "vote": Map { "pair": List [ "Sunshine", "The Godfather" ] }, "entries": List [ "Dr Doolittle", "Trainspotting", "28 Days Later" ] }






npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\owner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v4.4.7
npm ERR! npm  v3.10.2
npm ERR! code ELIFECYCLE
npm ERR! react-hot-boilerplate@1.0.0 test: `mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the react-hot-boilerplate@1.0.0 test script 'mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-hot-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-hot-boilerplate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-hot-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\owner\react\voting\npm-debug.log

C:\Users\owner\react\voting>

Aucun commentaire:

Enregistrer un commentaire