File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -85,17 +85,27 @@ describe('HeroService', () => {
8585 it ( 'should not like a hero because no votes' , async ( ( ) => {
8686 localStorage . setItem ( 'votes' , String ( AppConfig . votesLimit ) ) ;
8787 expect ( heroService . checkIfUserCanVote ( ) ) . toBe ( false ) ;
88- heroService . like ( newHeroCreated ) . subscribe ( ( ) => {
89- } , ( error ) => {
90- expect ( error ) . toBe ( 'maximum votes' ) ;
88+ heroService . createHero ( {
89+ 'name' : 'test' ,
90+ 'alterEgo' : 'test'
91+ } ) . subscribe ( ( hero ) => {
92+ heroService . like ( hero ) . subscribe ( ( ) => {
93+ } , ( error ) => {
94+ expect ( error ) . toBe ( 'maximum votes' ) ;
95+ } ) ;
9196 } ) ;
9297 } ) ) ;
9398
9499 it ( 'should like a hero' , async ( ( ) => {
95100 localStorage . setItem ( 'votes' , String ( 0 ) ) ;
96101 expect ( heroService . checkIfUserCanVote ( ) ) . toBe ( true ) ;
97- heroService . like ( newHeroCreated ) . subscribe ( ( response ) => {
98- expect ( response ) . toEqual ( { } ) ;
102+ heroService . createHero ( {
103+ 'name' : 'test' ,
104+ 'alterEgo' : 'test'
105+ } ) . subscribe ( ( hero ) => {
106+ heroService . like ( hero ) . subscribe ( ( response ) => {
107+ expect ( response ) . toEqual ( { } ) ;
108+ } ) ;
99109 } ) ;
100110 } ) ) ;
101111
You can’t perform that action at this time.
0 commit comments