@@ -170,4 +170,22 tap.test(".tap() tests", async t => { | |||
|
170 | 170 | |
|
171 | 171 | t.same(side, [1,2], ".tap() should be processed synchronously"); |
|
172 | 172 | |
|
173 | }).catch(() => { }); | |
|
174 | ||
|
175 | tap.test(".while() tests", async t => { | |
|
176 | ||
|
177 | const seq = of(1, 2, 3, 4).while(v => v <= 2); | |
|
178 | ||
|
179 | t.same(await seq.collect(), [1, 2], "Should collect only taken elements"); | |
|
180 | ||
|
181 | const data: number[] = []; | |
|
182 | let complete = 0; | |
|
183 | seq.subscribe({ | |
|
184 | next: v => data.push(v), | |
|
185 | complete: () => complete++ | |
|
186 | }); | |
|
187 | ||
|
188 | t.same(data, [1, 2], "Should receive only taken elements"); | |
|
189 | t.equal(complete, 1, "Complete should run once"); | |
|
190 | ||
|
173 | 191 | }).catch(() => {}); No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now