Closed brendanjerwin closed 10 years ago
I don't want to allow two ways to do the same thing, that can be confusing. What's the problem with just asserting?
I guess it'd have to be true.should.be(true)
?
That should do it. :)
Yeah... That works, but you don't think it's ugly/weird?
It's more consistent and doesn't add extra features. Should be a quite temporary statement too, I assume?
I suppose the only time it'd be permanent is when the callback being tested has no parameters. Otherwise the values there would be tested.
Hmm, testing callbacks sounds like a very low level testing for being BDD. Some data should be tested, otherwise it's not much of a test.
Well, another name for this style of testing is Context-Specification. Referring to the way the context is established followed by specifications.
I find this style of testing to be quite nice for test driving my work. BDD or not, this test framework is making my life better!
Sure, I know about Context-Specification, if it's the same as When/Should (and similar to Given/When/Then). How do you structure such a test case using Buddy? It would be interesting to see.
Well, at the moment, since the before
s don't 'stack' my tests stay pretty shallow.
But, similar test suites, in coffee script on mocha, tend to grow deeper as the functionality gets more interesting. I use test file size as an indicator that my component may have too much to do. (SRP and all that...)
If you have a link to some testing code, I'd be interested in taking a look. Closing this for now.
Just ran into another case where this behavior is weird.
Using mockatoo, I simply wanted to verify a mock method in the it
. It kept showing up 'pending' until I did true.should.be(true)
... Even calling done()
wouldn't mark it as passed.
The behavior in mocha and jasmine is that a test is pending if it has no function, but passed if the provided function runs without exceptions. I think that behavior, or at least being able to call done()
to indicate that the test did something, would be nice.
Good idea, I've updated it now so a call to done() from a spec with no assertions will pass the test. Thanks. :)
Cool. A little bit more obvious now. Thx.
Right now, the only way to mark a test as not pending is to actually assert.
Sometimes, I just want to see that my callback happened...