ciscoheat / buddy

Your friendly BDD testing library for Haxe!
MIT License
96 stars 24 forks source link

Pending async tests #30

Closed jasononeil closed 9 years ago

jasononeil commented 9 years ago

I am setting up many tests (about 60) that are pending for now, but will be async tests once implemented.

// PENDING:
it("Should send an email to that teacher, with a pre-approved invitation", function () {});

// PASS:
it("Should send an email to that teacher, with a pre-approved invitation", function (done) { done(); });

I feel these should both be pending. Do you agree?

ciscoheat commented 9 years ago

In a way, yes. :) My original thinking was that tests with only a string (no function/implementation) should be pending:

it("Should send an email to that teacher, with a pre-approved invitation");

With any implementation the test should be either passed or fail. However the macro expands the above to an empty function, so your first test is syntactically identical to that, and no assertions generally means pending, so I guess the solution would be to test if any should assertions has been made and make the test pending if not. How about that?

ciscoheat commented 9 years ago

Now I remember the reason for allowing done without assertions to pass: https://github.com/ciscoheat/buddy/issues/20

Specifically: 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.

jasononeil commented 9 years ago

Ah, it() can be called with only a string - I hadn't realised. That's clean enough that I'll just do that. :)