This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 11/// <reference path="../../typings/globals/jest/index.d.ts" />
2+
23import reducer from './reducer' ;
34import * as types from './types' ;
45
Original file line number Diff line number Diff line change 11import { HINT_POSITION_SET } from './types' ;
2-
2+ /**
3+ * sets hint index
4+ * @param { } hintPosition=0
5+ * @param {Action } action
6+ * @returns number
7+ */
38export default function hintPositionReducer (
49 hintPosition = 0 , action : Action
510) : number {
Original file line number Diff line number Diff line change 1+ /// <reference path="../../typings/globals/jest/index.d.ts" />
2+
3+ import reducer from './index' ;
4+ import { HINT_POSITION_SET } from './types' ;
5+
6+ describe ( 'hint reducer' , ( ) => {
7+
8+ it ( 'should do nothing if no triggered action type' , ( ) => {
9+ const action = { type : 'unknown' } ;
10+ expect ( reducer ( undefined , action ) ) . toBe ( 0 ) ;
11+ } ) ;
12+
13+ it ( 'should handle HINT_POSITION_SET' , ( ) => {
14+ const hintPosition = 2 ;
15+ const action = { type : HINT_POSITION_SET , payload : { hintPosition } } ;
16+ expect ( reducer ( 0 , action ) ) . toBe ( hintPosition ) ;
17+ } ) ;
18+
19+ } ) ;
You can’t perform that action at this time.
0 commit comments