[Unit testing RxJS] Test hot observables with marbles
with test Rxjs Testing unit hot Observables
2023-09-14 09:00:45 时间
const { TestScheduler } = require("rxjs/testing");
const { map, take } = require("rxjs/operators");
const { concat } = require("rxjs");
describe("Marble testing in Rxjs", () => {
let testScheduler;
beforeEach(() => {
testScheduler = new TestScheduler((actual, expected) => {
expect(actual).toEqual(expected);
});
});
it("should let you test hot observables", () => {
testScheduler.run((helpers) => {
const { hot, expectObservable } = helpers;
// in this case, hot == cold
const source$ = hot("-a-b--c");
const expected = "-a-b--c";
expectObservable(source$).toBe(expected);
// ^: means there is an subsrcitpion comes in
const source2$ = hot("-a-b-^-c");
const expected2 = "--c";
expectObservable(source2$).toBe(expected2);
// take completed case
const final$ = source2$.pipe(take(1));
const expected3 = "--(c|)";
expectObservable(final$).toBe(expected3);
});
});
});
相关文章
- 优雅地乱玩 Redux-2-Usage with React
- varchar与char的转换_character with byte sequence
- ORA-19721: Cannot find datafile with absolute file number string in tablespace string ORACLE 报错 故障修复 远程处理
- ORA-22810: cannot modify object attributes with REF dereferencing ORACLE 报错 故障修复 远程处理
- ORA-25028: regular trigger body can not start with keyword COMPOUND ORACLE 报错 故障修复 远程处理
- ORA-28338: Column(s) cannot be both indexed and encrypted with salt ORACLE 报错 故障修复 远程处理
- ORA-32035: unreferenced query name defined in WITH clause ORACLE 报错 故障修复 远程处理
- ORA-39322: Cannot use transportable tablespace with TIMESTAMP WITH TIME ZONE columns and different time zone version. ORACLE 报错 故障修复 远程处理
- ORA-00481: LMON process terminated with error ORACLE 报错 故障修复 远程处理
- ORA-00828: specified value of shared_pool_reserved_size inconsistent with internal settings ORACLE 报错 故障修复 远程处理
- ORA-03243: destination dba overlaps with existing control information ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-011529; Symbol: ER_GRP_RPL_MEMBER_CFG_INCOMPATIBLE_WITH_GRP_CFG; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-15478: ACFS process terminated with error ORACLE 报错 故障修复 远程处理
- Working with EXIT, STOP, CONTINUE and RETURN in SAP ABAP详解编程语言
- Download Any File Easier than Ever with macOS Wget(macOSwget)
- Efficient Cryptocurrency Mining Made Easy with Minerd Linux(minerdlinux)
- Maximizing Financial Efficiency with Oracle Financial Management(oracle财务管理)
- Streamlining Web Development with Linux LNMP An Essential Guide for Entrepreneurs and Developers(linuxlnmp)
- Boost Your File Transfer Efficiency with Linux Wput The Ultimate Tool for Uploading Large Files!(linuxwput)
- Effortlessly Convert Your Images on Linux with These Top Tools(linux图片格式转换)
- Mastering Oracle: Test Your Skills with Our Ultimate Oracle Testing Questions!(oracle测试题)
- 分析学习Oracle深入理解使用With 分析(oracle使用with)
- Oracle中利用WITH子句的使用(oracle中的with)
- 语句使用Oracle两个WITH语句实现数据查询(oracle两个with)