我尝试用 Angular 9、Jasmine 和 RxJS 解决问题,但没有成功。我的单元测试由 Jasmine 运行,但有些代码行没有执行。
我一直在几篇文章中寻求帮助,但这些文章都无法提供适合我的问题的解决方案,我对此感到非常沮丧。
我需要帮助,请:)
课堂测试
describe('AuthRefreshAppInterceptor', () => {
let accessToken: string;
let endpoint: string;
let authAppServiceMock: AuthAppService;
let baseHTTPService: BaseHTTPService;
let environmentServiceMock: EnvironmentService;
let httpTestingController: HttpTestingController;
let sessionStorageServiceMock: SessionStorageService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [
CriptografiaService,
BaseHTTPService,
{
provide: AuthAppService,
useValue: jasmine.createSpyObj('AuthAppService', ['getNewAuth', 'saveAuth', 'createBodyAuth', 'createBodyAuth'])
},
{
provide: EnvironmentService,
useValue: EnvironmentMock
},
{
provide: HTTP_INTERCEPTORS,
useClass: AutorizacaoErroAppInterceptor,
multi: true,
},
{
provide: SessionStorageService,
useValue: jasmine.createSpyObj('SessionStorageService', ['saveItem', 'getItem', 'removeItem'])
}
], …Run Code Online (Sandbox Code Playgroud)