Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea5941b

Browse files
committed
add hint tests
1 parentd8192a1 commitea5941b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

‎src/modules/editor/reducer.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="../../typings/globals/jest/index.d.ts" />
2+
23
importreducerfrom'./reducer';
34
import*astypesfrom'./types';
45

‎src/modules/hints/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import{HINT_POSITION_SET}from'./types';
2-
2+
/**
3+
* sets hint index
4+
*@param {} hintPosition=0
5+
*@param {Action} action
6+
*@returns number
7+
*/
38
exportdefaultfunctionhintPositionReducer(
49
hintPosition=0,action:Action
510
):number{

‎src/modules/hints/reducer.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// <reference path="../../typings/globals/jest/index.d.ts" />
2+
3+
importreducerfrom'./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+
constaction={type:'unknown'};
10+
expect(reducer(undefined,action)).toBe(0);
11+
});
12+
13+
it('should handle HINT_POSITION_SET',()=>{
14+
consthintPosition=2;
15+
constaction={type:HINT_POSITION_SET,payload:{ hintPosition}};
16+
expect(reducer(0,action)).toBe(hintPosition);
17+
});
18+
19+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp