This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
147 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as effects from 'redux-saga/effects' | ||
import { delay } from 'redux-saga' | ||
import * as helpers from '../test_helper' | ||
|
||
describe('react-redux-saga-router integration tests: url changes', () => { | ||
|
||
function another() { | ||
return 'hi' | ||
} | ||
|
||
function *foo(d) { | ||
while (true) { | ||
yield effects.take('hi') | ||
yield delay(d) | ||
yield effects.call(another) | ||
yield effects.put({ type: 'there', payload: 'wheee' }) | ||
} | ||
} | ||
|
||
const run = helpers.testSaga() | ||
it('proof of concept', (done) => { | ||
run([ | ||
[foo, 1500] | ||
], function *() { | ||
yield effects.put.resolve(helpers.START) | ||
yield effects.put({ type: 'hi', payload: 'there' }) | ||
let input = yield effects.take('take') | ||
|
||
expect(input.effect).eqls(effects.take('hi')) | ||
|
||
yield effects.take('promise') | ||
input = yield effects.take('call') | ||
expect(input.effect).eqls(effects.call(another)) | ||
|
||
input = yield effects.take('put') | ||
expect(input.effect).eqls(effects.put({ type: 'there', payload: 'wheee' })) | ||
|
||
yield effects.call(done) | ||
}) | ||
}) | ||
}) |
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