| 123456789101112131415161718192021222324252627282930 |
- import { TestBed } from '@angular/core/testing';
- import { JwtInterceptor } from './jwt.interceptor';
- import { HttpClientTestingModule } from '@angular/common/http/testing';
- import { AuthService } from '../services/auth.service';
- import { Router } from '@angular/router';
- class MockAuthService {}
- class MockRouter {}
- describe('JwtInterceptor', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [HttpClientTestingModule],
- providers: [
- JwtInterceptor,
- { provide: AuthService, useClass: MockAuthService },
- { provide: Router, useClass: MockRouter },
- // ... other providers if needed
- ],
- });
- });
- it('should be created', () => {
- const interceptor: JwtInterceptor = TestBed.inject(JwtInterceptor);
- expect(interceptor).toBeTruthy();
- });
- // Add more test cases as needed
- });
|