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

Commitd06bc00

Browse files
committed
tests: use Redux in tests
It's a good way to test that redux-machine works with Redux!
1 parent126ae45 commitd06bc00

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎test.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use strict"
22

3-
const{createMachine}=require('./index.js')
3+
const{createStore}=require('redux')
44
consttest=require('tape')
5+
const{ createMachine}=require('./index.js')
56

67
// BEGIN FIXTURES
78

@@ -52,12 +53,14 @@ test('should transition between states', t => {
5253

5354
letstate=undefined
5455
letprevState=undefined
56+
conststore=createStore(fetchUsersReducer,state)
5557

5658
constexpect=(expected,maybeMessage)=>t.deepEquals(state,expected,maybeMessage)
5759

5860
constaction=(type,payload)=>{
5961
prevState=state
60-
state=fetchUsersReducer(state,{type, payload})
62+
store.dispatch({type, payload})
63+
state=store.getState()
6164
}
6265

6366
action('DUMMY')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp