11import GreetingStore from '../../src/stores/GreetingStore' ;
22import GreetingActionTypes from '../../src/constants/action-types/GreetingActionTypes' ;
3+ import { AddGreetingEvent , RemoveGreeting , NewGreetingChanged } from '../../src/actions/GreetingActions' ;
34
45const registeredCallback = GreetingStore . _onDispatch . bind ( GreetingStore ) ;
56
@@ -16,10 +17,7 @@ describe('GreetingStore', () => {
1617 } ) ;
1718
1819 it ( 'given an ADD_GREETING action with a newGreeting of \'Benjamin\', the newGreeting should be an empty string and greetings should contain \'Benjamin\'' , ( ) => {
19- [ {
20- payload : 'Benjamin' ,
21- type : GreetingActionTypes . ADD_GREETING ,
22- } ] . forEach ( registeredCallback ) ;
20+ [ new AddGreetingEvent ( 'Benjamin' ) ] . forEach ( registeredCallback ) ;
2321
2422 const { greetings, newGreeting } = GreetingStore . getState ( ) ;
2523
@@ -28,13 +26,7 @@ describe('GreetingStore', () => {
2826 } ) ;
2927
3028 it ( 'given an REMOVE_GREETING action with a greetingToRemove of \'Benjamin\', the state greetings should be an empty array' , ( ) => {
31- [ {
32- payload : 'Benjamin' ,
33- type : GreetingActionTypes . ADD_GREETING ,
34- } , {
35- payload : 'Benjamin' ,
36- type : GreetingActionTypes . REMOVE_GREETING ,
37- } ] . forEach ( registeredCallback ) ;
29+ [ new AddGreetingEvent ( 'Benjamin' ) , new RemoveGreeting ( 'Benjamin' ) ] . forEach ( registeredCallback ) ;
3830
3931 const { greetings } = GreetingStore . getState ( ) ;
4032
@@ -43,10 +35,7 @@ describe('GreetingStore', () => {
4335 } ) ;
4436
4537 it ( 'given a NEW_GREETING_CHANGED action with a newGreeting of \'Benjamin\', the state newGreeting should be \'Benjamin\'' , ( ) => {
46- [ {
47- payload : 'Benjamin' ,
48- type : GreetingActionTypes . NEW_GREETING_CHANGED ,
49- } ] . forEach ( registeredCallback ) ;
38+ [ new NewGreetingChanged ( 'Benjamin' ) ] . forEach ( registeredCallback ) ;
5039
5140 const { newGreeting } = GreetingStore . getState ( ) ;
5241
0 commit comments