Skip to content

Commit 5d34a94

Browse files
committed
add tests for pagePosition
1 parent ea5941b commit 5d34a94

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path="../../../typings/globals/jest/index.d.ts" />
2+
3+
import reducer from './index';
4+
import { PAGE_SET } from '../types';
5+
6+
describe('page position reducer', () => {
7+
8+
it('does nothing if no known action', () => {
9+
const action = { type: 'unknown' };
10+
expect(reducer(undefined, action)).toBe(0);
11+
});
12+
13+
it('handles PAGE_SET', () => {
14+
const pagePosition = 2;
15+
const action = { type: PAGE_SET, payload: { pagePosition } };
16+
expect(reducer(0, action)).toBe(pagePosition);
17+
});
18+
19+
it('handles PROGRESS_PAGE_POSITION', () => {
20+
const progress = {
21+
pages: [true, true, true, false, false]
22+
};
23+
const action = { type: 'PROGRESS_PAGE_POSITION', payload: { progress } };
24+
expect(reducer(0, action)).toBe(3);
25+
});
26+
27+
});

0 commit comments

Comments
 (0)