小编Ric*_*ick的帖子

Angular/Jasmine:无法读取未定义的属性“管道”

我尝试用 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)

unit-testing jasmine rxjs typescript angular

1
推荐指数
1
解决办法
9685
查看次数

标签 统计

angular ×1

jasmine ×1

rxjs ×1

typescript ×1

unit-testing ×1