当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript testing.SagaTester类代码示例

本文整理汇总了TypeScript中store-saga/testing.SagaTester的典型用法代码示例。如果您正苦于以下问题:TypeScript SagaTester类的具体用法?TypeScript SagaTester怎么用?TypeScript SagaTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SagaTester类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: describe

describe('Shop Effect LOAD', () => {
    let sagaTester: SagaTester;

    beforeEach(() => {
        const injector = Injector.resolveAndCreate([
            SagaTester, schedulerProvider
        ]);

        sagaTester = injector.get(SagaTester);
    });

    it('should dispatch products list', (done) => {

        sagaTester.run(sagas[0]);
        sagaTester.sendAction({ type: REQUEST_PRODUCTS });

        sagaTester.output
            .filter(Boolean)
            .subscribe(last => {
                expect(last).toEqual({ type: RECEIVED_PRODUCTS, payload: jsonProducts });
                done();
            });
    });

    it('should checkout products', (done) => {

        sagaTester.run(sagas[1]);
        sagaTester.sendAction({ type: CHECKOUT_REQUEST, payload: [0, 1] });

        sagaTester.output
            .filter(Boolean)
            .subscribe(last => {
                expect(last).toEqual({ type: CHECKOUT_SUCCESS, payload: 0 });
                done();
            });
    });
});
开发者ID:Lube,项目名称:ngrx-examples,代码行数:37,代码来源:shop.spec.ts

示例2: it

    it('should dispatch products list', (done) => {

        sagaTester.run(sagas[0]);
        sagaTester.sendAction({ type: REQUEST_PRODUCTS });

        sagaTester.output
            .filter(Boolean)
            .subscribe(last => {
                expect(last).toEqual({ type: RECEIVED_PRODUCTS, payload: jsonProducts });
                done();
            });
    });
开发者ID:Lube,项目名称:ngrx-examples,代码行数:12,代码来源:shop.spec.ts


注:本文中的store-saga/testing.SagaTester类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。