本文整理汇总了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();
});
});
});
示例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();
});
});