-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from jes708/test-reducers
For Jansen's Reference - Test reducers
- Loading branch information
Showing
2 changed files
with
24 additions
and
222 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
browser/js/reducers/assessments/__tests__/assessments.test.js
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,24 @@ | ||
'use strict' | ||
|
||
import { expect } from 'chai' | ||
import { byId, isFetching } from '../index' | ||
|
||
describe('Assessments Reducer', () => { | ||
|
||
describe('byId', () => { | ||
const id = '1' | ||
const assessment = { id, name: 'Test' } | ||
const loadAction = { type: 'LOAD_ASSESSMENTS_SUCCESS', assessments: [assessment] } | ||
|
||
it('provides the initial state', () => { | ||
expect(byId(undefined, {})).to.deep.equal({}) | ||
}) | ||
|
||
it('handles LOAD_ASSESSMENTS_SUCCESS action', () => { | ||
const nextState = byId(undefined, loadAction) | ||
expect(nextState[id]).to.deep.equal(assessment) | ||
}) | ||
|
||
}) | ||
}) | ||
|