File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
07-directives-deep-dive/01-starting-project/src/app/directives Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { AuthDirective } from './auth.directive' ;
2
2
3
+ import { TemplateRef , ViewContainerRef } from '@angular/core' ;
4
+ import { AuthService } from '../services/auth.service' ;
5
+
3
6
describe ( 'AuthDirective' , ( ) => {
7
+ let mockAuthService : jasmine . SpyObj < AuthService > ;
8
+ let mockTemplateRef : TemplateRef < any > ;
9
+ let mockViewContainerRef : ViewContainerRef ;
10
+
11
+ beforeEach ( ( ) => {
12
+ mockAuthService = jasmine . createSpyObj ( 'AuthService' , [ 'isAuthenticated' ] ) ;
13
+ mockTemplateRef = { } as TemplateRef < any > ;
14
+ mockViewContainerRef = { } as ViewContainerRef ;
15
+ } ) ;
16
+
4
17
it ( 'should create an instance' , ( ) => {
5
- const directive = new AuthDirective ( ) ;
18
+ const directive = new AuthDirective ( mockAuthService , mockTemplateRef , mockViewContainerRef ) ;
6
19
expect ( directive ) . toBeTruthy ( ) ;
7
20
} ) ;
8
21
} ) ;
You can’t perform that action at this time.
0 commit comments