forked from zalmoxisus/crossbuilder
-
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.
Change tests from redux according to our example
- Loading branch information
1 parent
65c52ca
commit ad53d01
Showing
2 changed files
with
11 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import expect from 'expect'; | ||
import counter from '../../../src/app/reducers/counter'; | ||
import { INCREMENT_COUNTER, DECREMENT_COUNTER } from '../../../src/app/actions/counter'; | ||
import { INCREMENT_COUNTER, DECREMENT_COUNTER } from '../../../src/app/constants/ActionTypes'; | ||
|
||
describe('reducers', () => { | ||
describe('counter', () => { | ||
it('should handle initial state', () => { | ||
expect(counter(undefined, {})).toBe(0); | ||
expect(counter(undefined, {})).toEqual({ count: 0 }); | ||
}); | ||
|
||
it('should handle INCREMENT_COUNTER', () => { | ||
expect(counter(1, { type: INCREMENT_COUNTER })).toBe(2); | ||
expect(counter({count: 1}, { type: INCREMENT_COUNTER })).toEqual({ count: 2 }); | ||
}); | ||
|
||
it('should handle DECREMENT_COUNTER', () => { | ||
expect(counter(1, { type: DECREMENT_COUNTER })).toBe(0); | ||
expect(counter({count: 1}, { type: DECREMENT_COUNTER })).toEqual({ count: 0 }); | ||
}); | ||
|
||
it('should handle unknown action type', () => { | ||
expect(counter(1, { type: 'unknown' })).toBe(1); | ||
expect(counter({count: 1}, { type: 'unknown' })).toEqual({ count: 1 }); | ||
}); | ||
}); | ||
}); |