generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
7 changed files
with
81 additions
and
20 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
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { workflowProgress } from './index'; | ||
|
||
describe('workflowProgress reducer', () => { | ||
const initialState = { | ||
get: { | ||
loaded: false, | ||
loading: false, | ||
error: null, | ||
}, | ||
}; | ||
|
||
it('handles WORKFLOW_PROGRESS_PENDING action', () => { | ||
const action = { type: 'WORKFLOW_PROGRESS_PENDING' }; | ||
const newState = workflowProgress(initialState, action); | ||
expect(newState).toMatchObject({ | ||
get: { | ||
loading: true, | ||
loaded: false, | ||
error: null, | ||
}, | ||
}); | ||
}); | ||
|
||
it('handles WORKFLOW_PROGRESS_SUCCESS action', () => { | ||
const action = { | ||
type: 'WORKFLOW_PROGRESS_SUCCESS', | ||
result: { someData: 'data' }, | ||
}; | ||
const newState = workflowProgress(initialState, action); | ||
expect(newState).toMatchObject({ | ||
get: { | ||
loading: false, | ||
loaded: true, | ||
error: null, | ||
}, | ||
result: { someData: 'data' }, | ||
}); | ||
}); | ||
|
||
it('handles WORKFLOW_PROGRESS_FAIL action', () => { | ||
const action = { | ||
type: 'WORKFLOW_PROGRESS_FAIL', | ||
error: 'Some error message', | ||
}; | ||
const newState = workflowProgress(initialState, action); | ||
expect(newState).toMatchObject({ | ||
get: { | ||
loading: false, | ||
loaded: false, | ||
error: 'Some error message', | ||
}, | ||
}); | ||
}); | ||
|
||
it('returns the initial state when given an unknown action', () => { | ||
const action = { type: 'UNKNOWN_ACTION' }; | ||
const newState = workflowProgress(initialState, action); | ||
expect(newState).toMatchObject(initialState); | ||
}); | ||
}); |