-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from bsideup/rx5-fix
redo RxJS 5 support with adapters
- Loading branch information
Showing
12 changed files
with
389 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 24 additions & 3 deletions
27
src/__tests__/__snapshots__/mapActionCreators-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
import Rx from "rx"; | ||
import { mapActionCreators } from "../"; | ||
import { mapActionCreators, rxConnect } from "../"; | ||
import rx5Adapter from "../rx5Adapter"; | ||
import { getAdapter } from "../rxConnect"; | ||
|
||
test("passes non-observables as is", async () => { | ||
const props = await mapActionCreators({ a: 123, b: "hi!" }).toPromise(); | ||
const suites = { | ||
"RxJS 4": () => {}, | ||
"RxJS 5": () => rxConnect.adapter = rx5Adapter | ||
} | ||
|
||
expect(props).toMatchSnapshot(); | ||
}); | ||
Object.entries(suites).forEach(([ name, initializer ]) => describe(name, () => { | ||
let Rx; | ||
beforeEach(() => { | ||
initializer(); | ||
const adapter = getAdapter(); | ||
Rx = adapter.Rx; | ||
}); | ||
|
||
test("strips dollar sign from Observable property names", async () => { | ||
const actions = { | ||
a$: new Rx.Subject() | ||
}; | ||
it("passes non-observables as is", async () => { | ||
const props = await mapActionCreators({ a: 123, b: "hi!" }).toPromise(); | ||
|
||
const props = await mapActionCreators(actions).toPromise(); | ||
expect(props).toMatchSnapshot(); | ||
}); | ||
|
||
expect(props).toMatchSnapshot(); | ||
}); | ||
it("strips dollar sign from Observable property names", async () => { | ||
const actions = { | ||
a$: new Rx.Subject() | ||
}; | ||
|
||
test("creates FuncSubject-like action", async () => { | ||
const actions = { | ||
a$: new Rx.BehaviorSubject() | ||
}; | ||
const props = await mapActionCreators(actions).toPromise(); | ||
|
||
const props = await mapActionCreators(actions).toPromise(); | ||
expect(props).toMatchSnapshot(); | ||
}); | ||
|
||
props.a(1, 2, 3); | ||
it("creates FuncSubject-like action", async () => { | ||
const actions = { | ||
a$: new Rx.BehaviorSubject() | ||
}; | ||
|
||
expect(actions.a$.getValue()).toMatchSnapshot(); | ||
}); | ||
const props = await mapActionCreators(actions).toPromise(); | ||
|
||
props.a(1, 2, 3); | ||
|
||
expect(actions.a$.getValue()).toMatchSnapshot(); | ||
}); | ||
|
||
})); |
Oops, something went wrong.