meteor-rtd-example-project icon indicating copy to clipboard operation
meteor-rtd-example-project copied to clipboard

In the cucumber feature "Actions.verifyTheirScoreIs" is no checking the score

Open merunga opened this issue 11 years ago • 7 comments

If you change the last step of the feature from Then "Grace Hopper" has a score of 15 to Then "Grace Hopper" has a score of 500000 The scenario will still pass.

To solve this I included chai.js in the test/lib, and replace this line with

var expect = require('../../lib/chai.js').expect;
expect(parseInt(value)).to.equal(parseInt(points));

merunga avatar Nov 07 '13 03:11 merunga

Thanks for the feedback, What's I forgot to do, is make the callback return with an error the way the cucumber boys do it. Of course you can still use an assertion library. I'll update the example.

samhatoum avatar Nov 07 '13 20:11 samhatoum

I just did what @merunga suggested, and got the example actually asserting correctness.

When I added test/lib/chai.js I got jslint issues, so I had to disable that.

chai.js adds 4k LOC — @samhatoum was there some other vision to make the expectation work besides including chai?

ryw avatar Dec 11 '13 02:12 ryw

@ryw we use Jasmine. You can use mocha or any assertion framework you like. I'm wondering though, can't you just exclude chai.js from jslint checking?

xolvio avatar Dec 11 '13 06:12 xolvio

It appears that jasmine is already in the project — the work to be done is to integrate jasmine into the feature actions file, right? I'd be happy to do a PR for this as part of my learning on RTD...

ryw avatar Dec 11 '13 13:12 ryw

yes. sort of :) jasmine-node runs the acceptance tests as you can see here. This npm module is installed globally and it's probably best to leave that one alone. You can either share the jasmine that karma includes here /test/rtd/node_modules/karma-jasmine, or just include the jasmine assertion library in your code.

xolvio avatar Dec 11 '13 14:12 xolvio

Thanks for help @xolvio — did you leave this cucumber feature as you did to give people flexibility to choose their own assertion library, or is the actions.js file just unfinished?

If unfinished, I'll help finish it — sounds like sharing jasmine from karma would be the best solution, vs creating another copy of the library...

ryw avatar Dec 11 '13 15:12 ryw

I had set up the feature quickly as a sample and for people to freely use the library they chose, but it would actually be good to include it so the example works. Would love the help. Thanks!

xolvio avatar Dec 11 '13 15:12 xolvio