AgileVentures / AgileVentures/WebsiteOne-FE
action unit test problem - always show success.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
!--- Provide a general summary of the issue in the Title above -->
the action contains side affection (use axios to retrieve the data from API ) .
the current unit test use moxios to mock data request from the API. However, the unit test did not write correctly.
I am using https://github.com/AgileVentures/WebsiteOne-FE/blob/develop/src/tests/actions/createProjectAction.test.js as an example. unit test (posts project info to Rails backend and returns without error ) -line 28
the purpose of the unit test is compare " the data in store after the dispatch action contains props data" to "the expectedActions "
## Expected Behavior
create a helper function to helper moxios use the right data when the user give the correct props and dispatch the action correctly the unit test should show success and if the "props" contains the wrong data the unit test should fail.
## Current Behavior
always success no matter what props data pass to the dispatch action. because we are using the expectedActions to compare with expectedActions.
## Possible Solution
correct the unit test
I will also create a separate ticket to separate the axios request from the action. try to isolate the side effect in a different ticket
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.