@@ -131,9 +131,40 @@ describe('UsersManagerPage', () => {
131131 it ( 'should be created' , ( ) => {
132132 expect ( component instanceof UsersManagerPage ) . toBe ( true ) ;
133133 } ) ;
134+
135+ it ( 'should display header component' , ( ) => {
136+ let de : DebugElement ;
137+ let el : HTMLElement ;
138+ de = fixture . debugElement . query ( By . css ( 'header' ) ) ;
139+ el = de . nativeElement . src ;
140+ expect ( el ) . toBeUndefined ( ) ;
141+ } ) ;
134142
135- it ( 'should have title called Manage Users' , ( ) => {
136- expect ( component . title ) . toBe ( 'Manage Users' ) ;
143+ it ( 'should have title called Users Manager' , ( ) => {
144+ expect ( component . title ) . toBe ( 'Users Manager' ) ;
145+ } ) ;
146+
147+ it ( 'should load blocked users on view load' , ( ) => {
148+ spyOn ( component , 'loadBlockedUsers' ) . and . returnValue ( { subscribe : ( ) => { } } ) ;
149+ component . ionViewDidLoad ( ) ;
150+ expect ( component . loadBlockedUsers ) . toHaveBeenCalled ( ) ;
137151 } ) ;
138152
153+ it ( 'should display blocked users if there are any' , ( ) => {
154+ component . thereAreBlockedUsers = true ;
155+ fixture . detectChanges ( ) ;
156+ let de : DebugElement ;
157+ let el : HTMLElement ;
158+ de = fixture . debugElement . query ( By . css ( 'h3' ) ) ;
159+ el = de . nativeElement . innerHTML
160+ expect ( el ) . toContain ( 'Blocked Users' )
161+ } ) ;
162+
163+ it ( 'should unblock user' , fakeAsync ( ( ) => {
164+ component . firebase . list ( 'testPath' ) . push ( 'user' )
165+ tick ( ) ;
166+ fixture . detectChanges ( ) ;
167+ expect ( listSpy ) . toHaveBeenCalled ( ) ;
168+ expect ( pushSpy ) . toHaveBeenCalled ( ) ;
169+ } ) ) ;
139170} ) ;
0 commit comments