Skip to content

Commit

Permalink
fix(most-run): export run function
Browse files Browse the repository at this point in the history
PR #421

Allows destructuring usage. Also includes corresponding test for all *-run packages to prevent things like #411.
  • Loading branch information
storybook-safe-bot authored and staltz committed Sep 4, 2016
1 parent 2dcd64e commit e409bf9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions most-run/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import MostAdapter from '@cycle/most-adapter';
* Cycle.js program, cleaning up resources used.
* @function run
*/
function run<Sources, Sinks>(main: (sources: Sources) => Sinks,
drivers: DriversDefinition): DisposeFunction {
export function run<Sources, Sinks>(main: (sources: Sources) => Sinks,
drivers: DriversDefinition): DisposeFunction {
return CycleBase(main, drivers, {streamAdapter: MostAdapter}).run();
}

Expand Down
5 changes: 5 additions & 0 deletions most-run/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require('creed').shim()
let assert = require('power-assert');
let Cycle = require('../lib/index').default;
let {run} = require('../lib/index');
let most = require('most');
let sinon = require('sinon');

Expand All @@ -12,6 +13,10 @@ describe('Cycle', function () {
assert.strictEqual(typeof Cycle.run, 'function');
});

it('should export `run`', function () {
assert.strictEqual(run, Cycle.run);
});

it('should throw if first argument is not a function', function () {
assert.throws(() => {
Cycle('not a function');
Expand Down
5 changes: 5 additions & 0 deletions rx-run/test/cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global describe, it */
let assert = require('assert');
let Cycle = require('../lib/index').default;
let {run} = require('../lib/index');
let Rx = require('rx');
let sinon = require('sinon');

Expand All @@ -11,6 +12,10 @@ describe('Cycle', function () {
assert.strictEqual(typeof Cycle.run, 'function');
});

it('should export `run`', function () {
assert.strictEqual(run, Cycle.run);
});

it('should throw if first argument is not a function', function () {
assert.throws(() => {
Cycle('not a function');
Expand Down
5 changes: 5 additions & 0 deletions rxjs-run/test/cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global describe, it */
let assert = require('assert');
let Cycle = require('../lib/index').default;
let {run} = require('../lib/index');
let Rx = require('rxjs');
let sinon = require('sinon');

Expand All @@ -11,6 +12,10 @@ describe('Cycle', function () {
assert.strictEqual(typeof Cycle.run, 'function');
});

it('should export `run`', function () {
assert.strictEqual(run, Cycle.run);
});

it('should throw if first argument is not a function', function () {
assert.throws(() => {
Cycle('not a function');
Expand Down
5 changes: 5 additions & 0 deletions xstream-run/test/cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global describe, it */
let assert = require('assert');
let Cycle = require('../lib/index').default;
let {run} = require('../lib/index');
let xs = require('xstream').default;
let concat = require('xstream/extra/concat').default;
let delay = require('xstream/extra/delay').default;
Expand All @@ -18,6 +19,10 @@ describe('Cycle', function () {
assert.strictEqual(typeof Cycle.run, 'function');
});

it('should export `run`', function () {
assert.strictEqual(run, Cycle.run);
});

it('should throw if first argument is not a function', function () {
assert.throws(() => {
Cycle('not a function');
Expand Down

0 comments on commit e409bf9

Please sign in to comment.