File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " legit-tests" ,
3- "version" : " 0.5.2 " ,
3+ "version" : " 0.5.3 " ,
44 "description" : " a chainable testing library for React" ,
55 "main" : " legit-tests.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -6,6 +6,14 @@ class TestStore {
66 this . actions = actions
77 }
88
9+ wait ( callback , duration = 0 ) {
10+ setTimeout ( ( ) => {
11+ callback . call ( this , this . store )
12+ } , duration )
13+
14+ return this
15+ }
16+
917 test ( callback ) {
1018 callback . call ( this , this . store )
1119 return this
Original file line number Diff line number Diff line change @@ -40,4 +40,16 @@ describe('TestStore', () => {
4040 } )
4141 } )
4242 } )
43+
44+ describe ( 'wait' , ( ) => {
45+ it ( 'should wait for the method to finish before running tests' , ( done ) => {
46+ TestStore ( MyStore , MyActions )
47+ . setInitialState ( { todos : todos } )
48+ . addTodo ( { title : "Get Beer" , complete : false } )
49+ . wait ( ( { state } ) => {
50+ expect ( state . todos ) . to . eql ( expected )
51+ done ( )
52+ } , 100 )
53+ } )
54+ } )
4355} )
You can’t perform that action at this time.
0 commit comments