Skip to content

Commit 39de998

Browse files
aimxnaimCopilot
andauthored
Update 07-directives-deep-dive/01-starting-project/src/app/directives/auth.directive.spec.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 60d4dc5 commit 39de998

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import { AuthDirective } from './auth.directive';
22

3+
import { TemplateRef, ViewContainerRef } from '@angular/core';
4+
import { AuthService } from '../services/auth.service';
5+
36
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+
417
it('should create an instance', () => {
5-
const directive = new AuthDirective();
18+
const directive = new AuthDirective(mockAuthService, mockTemplateRef, mockViewContainerRef);
619
expect(directive).toBeTruthy();
720
});
821
});

0 commit comments

Comments
 (0)