File tree Expand file tree Collapse file tree 8 files changed +64
-22
lines changed Expand file tree Collapse file tree 8 files changed +64
-22
lines changed Original file line number Diff line number Diff line change 427427 "description" : " The power of middleware with \" redux-logger\" .\n\n Explanation here." ,
428428 "tasks" : [
429429 {
430- "description" : " import `applyMiddleware` in \" index.js\" " ,
430+ "description" : " import `applyMiddleware` in \" index.js\" from the \" redux \" package. It is a named import. " ,
431431 "tests" : [
432432 " 08/01"
433433 ],
439439 "description" : " set the second param in createStore to `applyMiddleware()`" ,
440440 "tests" : [
441441 " 08/02"
442+ ],
443+ "hints" : [
444+ " Try this: `createStore(reducers, applyMiddleware());`"
442445 ]
443446 },
444447 {
445448 "description" : " install \" redux-logger\" using npm" ,
446449 "tests" : [
447450 " 08/03"
451+ ],
452+ "hints" : [
453+ " Try this: `npm install --save-dev redux-logger`"
448454 ]
449455 },
450456 {
451- "description" : " create a \" logger\" as the result of `createLogger()` " ,
457+ "description" : " import `createLogger` from the \" redux- logger\" package. It is a default import. " ,
452458 "tests" : [
453459 " 08/04"
460+ ],
461+ "hints" : [
462+ " Try this: `import createLogger from 'redux-logger';`"
454463 ]
455464 },
456465 {
457- "description" : " pass \" logger\" into `applyMiddleware ()`" ,
466+ "description" : " create a \" logger\" as the result of `createLogger ()`" ,
458467 "tests" : [
459468 " 08/05"
469+ ],
470+ "hints" : [
471+ " Note that `logger` should be above `store`." ,
472+ " Try this: `const logger = createLogger()`"
473+ ]
474+ },
475+ {
476+ "description" : " pass \" logger\" into `applyMiddleware()`" ,
477+ "tests" : [
478+ " 08/06"
479+ ],
480+ "hints" : [
481+ " Try this: `applyMiddleware(logger)`"
460482 ]
461483 }
462484 ],
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ chai.use(spies);
55
66let spy = chai . spy . on ( console , 'log' ) ;
77
8- const indexJs = require ( 'BASE/index.js' ) ;
8+ const indexJs = require ( 'BASE/src/ index.js' ) ;
99
1010describe ( '01 applyMiddleware' , ( ) => {
1111
Original file line number Diff line number Diff line change 11describe ( '02 createStore' , ( ) => {
22
3- // it('should call applyMiddleware', () => {
4- // console.log("createStore", createStore);
5- // });
3+ it ( 'should call applyMiddleware' , ( ) => {
4+ const regex = / ^ [ a - z ] + \s s t o r e \s ? = .* a p p l y M i d d l e w a r e \( .+ \) / m;
5+ expect ( indexJs . __text__ . to . match ( regex ) ;
6+ } ) ;
67
78} ) ;
Original file line number Diff line number Diff line change 1- describe ( '03 redux-logger' )
1+ describe ( '03 redux-logger' , ( ) => {
22
33 it ( 'should be installed. `npm i -D redux-logger`' , ( ) => {
44 expect ( exists ( 'node_modules/redux-logger' ) ) . to . be . true ;
Original file line number Diff line number Diff line change 1- describe ( '04 logger' , ( ) => {
2-
3- const logger = indexJs . __get__ ( 'logger' ) ;
4-
5- it ( 'doesn\'t exist' , ( ) => {
6- expect ( logger ) . to . not . be . undefined ;
7- } ) ;
8-
9- it ( 'should be set to `createLogger()`' , ( ) => {
1+ describe ( '04 import' , ( ) => {
102
3+ it ( 'createLogger' , ( ) => {
4+ const createLogger = indexJs . __get__ ( 'createLogger' ) ;
5+ expect ( createLogger ) . to . not . be . undefined ;
6+ expect ( typeof createLogger ) . to . equal ( 'function' ) ;
117 } ) ;
128
139} ) ;
Original file line number Diff line number Diff line change 1- describe ( '05 applyMiddleware logger' , ( ) => {
1+ describe ( '05 logger' , ( ) => {
22
3- it ( '' , ( ) => {
3+ const logger = indexJs . __get__ ( 'logger' ) ;
4+
5+ it ( 'doesn\'t exist' , ( ) => {
6+ expect ( logger ) . to . not . be . undefined ;
7+ } ) ;
8+
9+ it ( 'should be set to `createLogger()`' , ( ) => {
410
511 } ) ;
612
Original file line number Diff line number Diff line change 1+ describe ( '06 logger' , ( ) => {
2+
3+ it ( 'should be called by applyMiddleware' , ( ) => {
4+ const regex = / ^ [ a - z ] + \s s t o r e \s ? = .+ a p p l y M i d d l e w a r e \( .* l o g g e r .* \) / m;
5+ expect ( indexJs . __text__ ) . to . match ( regex ) ;
6+ } ) ;
7+
8+ } ) ;
Original file line number Diff line number Diff line change @@ -3,20 +3,29 @@ The power of middleware with "redux-logger".
33
44Explanation here.
55
6- + import ` applyMiddleware ` in "index.js"
6+ + import ` applyMiddleware ` in "index.js" from the "redux" package. It is a named import.
77@test ('08/01')
88@action (open('src/index.js'))
99
1010+ set the second param in createStore to ` applyMiddleware() `
1111@test ('08/02')
12+ @hint ('Try this: ` createStore(reducers, applyMiddleware()); ` ')
1213
1314+ install "redux-logger" using npm
1415@test ('08/03')
16+ @hint ('Try this: ` npm install --save-dev redux-logger ` ')
1517
16- + create a " logger" as the result of ` createLogger() `
18+ + import ` createLogger ` from the "redux- logger" package. It is a default import.
1719@test ('08/04')
20+ @hint ('Try this: ` import createLogger from 'redux-logger'; ` ')
1821
19- + pass "logger" into ` applyMiddleware ()`
22+ + create a "logger" as the result of ` createLogger ()`
2023@test ('08/05')
24+ @hint ('Note that ` logger ` should be above ` store ` .')
25+ @hint ('Try this: ` const logger = createLogger() ` ')
26+
27+ + pass "logger" into ` applyMiddleware() `
28+ @test ('08/06')
29+ @hint ('Try this: ` applyMiddleware(logger) ` ')
2130
2231@onPageComplete ('Look in the console')
You can’t perform that action at this time.
0 commit comments