-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
This commit: * Fixes a bug in which entities deleted by the server were not deleted in state. This happened when the server did not respond with the deleted entity’s ID, which is a likely scenario causing a bug in most cases. To delete an entity, dispatch the `destroy` thunk action passing in the entity to delete as the parameter. The entity to delete must have an `id` key.
const state = mockStore.getState(); | ||
|
||
expect(destroySuccessAction.payload).toEqual({ data: { id: userStub.id } }); | ||
expect(config.reducer(state, destroySuccessAction)).toEqual(store); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how to test the full reducer/thunk implementation using redux-mock-store
. Since the mock store cannot be configured with reducers we need to explicitly call the reducer here.
More info here: reduxjs/redux-mock-store#71 (comment)
@@ -107,6 +107,8 @@ class BaseConfig { | |||
...this._genericActions(TYPES.DESTROY), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this, or is what you added below taking its place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get a couple additional actions with this, and additions below override the necessary actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh okay. I figured i was missing something im trying to catch up with whats going on and also review lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as i can tell this does what it says it does. 👍
I concur with Jacques 👍 |
This commit:
This happened when the server did not respond with the deleted entity’s ID, which is a likely scenario causing a bug in most cases.
To delete an entity, dispatch the
destroy
thunk action passing in the entity to delete as the parameter. The entity to delete must have anid
key.closes #12