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 1
1
/// <reference path="../../typings/globals/jest/index.d.ts" />
2
+
2
3
import reducer from './reducer' ;
3
4
import * as types from './types' ;
4
5
Original file line number Diff line number Diff line change 1
1
import { HINT_POSITION_SET } from './types' ;
2
-
2
+ /**
3
+ * sets hint index
4
+ * @param { } hintPosition=0
5
+ * @param {Action } action
6
+ * @returns number
7
+ */
3
8
export default function hintPositionReducer (
4
9
hintPosition = 0 , action : Action
5
10
) : 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