How do I check for anonymous functions?redux observable: Why don`t can get all actions in testredux-observable epic chain dispatches duplicate actionswhat should each chained function return in redux-observable?Why Doesn't This Bit of Code Work Without My Hack?Dispatching additional actions conditionally from redux-observable epicHow to prevent starting the same call twice from epicAwait the asynchronous dispatch of an action in redux-observableHow to dispatch an action in retryWhen of ajax request in epic function [redux-observable middleware]IF in Redux Observable epicRxJS iif arguments are called when shouldn't
Bit one of the Intel 8080's Flags register
How do we know that black holes are spinning?
Extra initial Aeneid lines in 1662 M. de Marolles version
Why does Kubuntu 19.04 show an update that apparently doesn't exist?
What 68-pin connector is this on my 2.5" solid state drive?
Why is it called a stateful and a stateless firewall?
What do these two notes together mean?
How to make classical firearms effective on space habitats despite the coriolis effect?
Insight into cavity resonators
Are there objective criteria for classifying consonance v. dissonance?
How to give my students a straightedge instead of a ruler
What was the ultimate objective of The Party in 1984?
A command to output each line forward then backwards
Why is belonging not transitive?
Answer Not A Fool, or Answer A Fool?
Why is my fire extinguisher emptied after one use?
In what state are satellites left in when they are left in a graveyard orbit?
Wrong Schengen Visa exit stamp on my passport, who can I complain to?
What would happen if Protagoras v Euathlus were heard in court today?
Teleport everything in a large zone; or teleport all living things and make a lot of equipment disappear
Why is this sentence grammatical?
Amortized Loans seem to benefit the bank more than the customer
Statistical tests for benchmark comparison
How to draw a Venn diagram for X - (Y intersect Z)?
How do I check for anonymous functions?
redux observable: Why don`t can get all actions in testredux-observable epic chain dispatches duplicate actionswhat should each chained function return in redux-observable?Why Doesn't This Bit of Code Work Without My Hack?Dispatching additional actions conditionally from redux-observable epicHow to prevent starting the same call twice from epicAwait the asynchronous dispatch of an action in redux-observableHow to dispatch an action in retryWhen of ajax request in epic function [redux-observable middleware]IF in Redux Observable epicRxJS iif arguments are called when shouldn't
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the following in an Epic:
mergeMap(result => concat(
of(fetchDone(result)),
of(dispatchActions(payload))
))
And actions:
const fetchDone = result => ( type: "FETCH_DONE", payload: result );
function dispatchActions(payload)
return dispatch =>
dispatch(doStuff(payload));
...
;
The issue is in my test using marbles, I need to be able to check for the anonymous function because dispatchActions
is seen as anonymous. How do I do that?
const values =
...
b: type: "FETCH_DONE", payload: expected ,
c: NEEDS TO BE ANONYMOUS
;
...
const output$ = fetchApi(action$, state$);
// This fails due to the anonymous function
expectObservable(output$).toBe('---(bc)--', values);
redux-observable rxjs-marbles
add a comment
|
I have the following in an Epic:
mergeMap(result => concat(
of(fetchDone(result)),
of(dispatchActions(payload))
))
And actions:
const fetchDone = result => ( type: "FETCH_DONE", payload: result );
function dispatchActions(payload)
return dispatch =>
dispatch(doStuff(payload));
...
;
The issue is in my test using marbles, I need to be able to check for the anonymous function because dispatchActions
is seen as anonymous. How do I do that?
const values =
...
b: type: "FETCH_DONE", payload: expected ,
c: NEEDS TO BE ANONYMOUS
;
...
const output$ = fetchApi(action$, state$);
// This fails due to the anonymous function
expectObservable(output$).toBe('---(bc)--', values);
redux-observable rxjs-marbles
add a comment
|
I have the following in an Epic:
mergeMap(result => concat(
of(fetchDone(result)),
of(dispatchActions(payload))
))
And actions:
const fetchDone = result => ( type: "FETCH_DONE", payload: result );
function dispatchActions(payload)
return dispatch =>
dispatch(doStuff(payload));
...
;
The issue is in my test using marbles, I need to be able to check for the anonymous function because dispatchActions
is seen as anonymous. How do I do that?
const values =
...
b: type: "FETCH_DONE", payload: expected ,
c: NEEDS TO BE ANONYMOUS
;
...
const output$ = fetchApi(action$, state$);
// This fails due to the anonymous function
expectObservable(output$).toBe('---(bc)--', values);
redux-observable rxjs-marbles
I have the following in an Epic:
mergeMap(result => concat(
of(fetchDone(result)),
of(dispatchActions(payload))
))
And actions:
const fetchDone = result => ( type: "FETCH_DONE", payload: result );
function dispatchActions(payload)
return dispatch =>
dispatch(doStuff(payload));
...
;
The issue is in my test using marbles, I need to be able to check for the anonymous function because dispatchActions
is seen as anonymous. How do I do that?
const values =
...
b: type: "FETCH_DONE", payload: expected ,
c: NEEDS TO BE ANONYMOUS
;
...
const output$ = fetchApi(action$, state$);
// This fails due to the anonymous function
expectObservable(output$).toBe('---(bc)--', values);
redux-observable rxjs-marbles
redux-observable rxjs-marbles
asked Mar 28 at 12:30
NJBNJB
263 bronze badges
263 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
As a workaround, I'm doing:
function dispatchActions(payload)
if (payload.callDispatches)
return dispatch =>
dispatch(doStuff(payload));
...
;
return type: "SOME_TYPE" ;
Then in the unit test, I just check against the 2nd return. And the if-condition test can just be handled in a separate test outside of marbles.
This isn't ideal, but solves the issue for now. There should be some way to test redux-thunk
s using marbles though.
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397709%2fhow-do-i-check-for-anonymous-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As a workaround, I'm doing:
function dispatchActions(payload)
if (payload.callDispatches)
return dispatch =>
dispatch(doStuff(payload));
...
;
return type: "SOME_TYPE" ;
Then in the unit test, I just check against the 2nd return. And the if-condition test can just be handled in a separate test outside of marbles.
This isn't ideal, but solves the issue for now. There should be some way to test redux-thunk
s using marbles though.
add a comment
|
As a workaround, I'm doing:
function dispatchActions(payload)
if (payload.callDispatches)
return dispatch =>
dispatch(doStuff(payload));
...
;
return type: "SOME_TYPE" ;
Then in the unit test, I just check against the 2nd return. And the if-condition test can just be handled in a separate test outside of marbles.
This isn't ideal, but solves the issue for now. There should be some way to test redux-thunk
s using marbles though.
add a comment
|
As a workaround, I'm doing:
function dispatchActions(payload)
if (payload.callDispatches)
return dispatch =>
dispatch(doStuff(payload));
...
;
return type: "SOME_TYPE" ;
Then in the unit test, I just check against the 2nd return. And the if-condition test can just be handled in a separate test outside of marbles.
This isn't ideal, but solves the issue for now. There should be some way to test redux-thunk
s using marbles though.
As a workaround, I'm doing:
function dispatchActions(payload)
if (payload.callDispatches)
return dispatch =>
dispatch(doStuff(payload));
...
;
return type: "SOME_TYPE" ;
Then in the unit test, I just check against the 2nd return. And the if-condition test can just be handled in a separate test outside of marbles.
This isn't ideal, but solves the issue for now. There should be some way to test redux-thunk
s using marbles though.
answered Mar 28 at 15:23
NJBNJB
263 bronze badges
263 bronze badges
add a comment
|
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55397709%2fhow-do-i-check-for-anonymous-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown