Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Fixed Issue#3 and unit tests#4

Closed
joashc wants to merge 4 commits intopostaljs:masterfrom
joashc:master
Closed

Fixed Issue#3 and unit tests#4
joashc wants to merge 4 commits intopostaljs:masterfrom
joashc:master

Conversation

@joashc
Copy link
Copy Markdown

@joashc joashc commented Oct 24, 2014

Fixed Issue #3, and a few other issues preventing the unit tests from passing.

Before these changes, we get the You can only make functions into Conduits error, as mentioned in Issue #3.

> postal.when@0.2.0 test
> mocha ./spec/*.js
6 failing

    1) postal.when when calling when with default behavior "before all" hook:
       Error: You can only make functions into Conduits.
    2) postal.when when calling when with default behavior "after all" hook:
       TypeError: Cannot call method 'dispose' of undefined
    3) postal.when when calling when with once = true "before all" hook:
       Error: You can only make functions into Conduits.
    4) postal.when when calling when with once = true "after all" hook:
       TypeError: Cannot call method 'dispose' of undefined
    5) postal.when when calling when with a timeout that triggers onError The onError callback should be invoked:
       Error: You can only make functions into Conduits.
    6) postal.when when calling when with a timeout that does NOT trigger onError data should match expected:
       Error: You can only make functions into Conduits.

npm ERR! Test failed.  See above for more details.

After adding no-op callbacks for subscriptions with undefined callbacks, and fixing a few other minor issues, all unit tests pass:

> postal.when@0.2.0 test
> mocha ./spec/*.js

  postal.when
      when calling when with default behavior
         ✓ should invoke the callback the expected number of times 
         ✓ data_a should match expected 
         ✓ data_b should match expected 
         ✓ data_c should match expected 
         ✓ data_d should match expected 
      when calling when with once = true
         ✓ should only invoke the callback once 
         ✓ data_a should match expected 
         ✓ data_b should match expected 
         ✓ data_c should match expected 
         ✓ data_d should match expected 
      when calling when with a timeout that triggers onError
         ✓ The onError callback should be invoked 
      when calling when with a timeout that does NOT trigger onError
         ✓ data should match expected (1111ms)

12 passing (1s)

@ifandelse ifandelse closed this Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"You can only make functions into Conduits."

2 participants