From 0ca92d5a720f6149e86175db8347e06aca055141 Mon Sep 17 00:00:00 2001 From: hypnos Date: Tue, 19 Jul 2016 00:19:35 +0300 Subject: [PATCH] Make `MemoryStream#remember` a true bypass --- src/core.ts | 4 ++++ tests/operator/remember.ts | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/core.ts b/src/core.ts index 6759401..4bdeb81 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1929,6 +1929,10 @@ export class MemoryStream extends Stream { return > super.replaceError(replace); } + remember(): MemoryStream { + return this; + } + debug(labelOrSpy?: string | ((t: T) => void)): MemoryStream { return > super.debug(labelOrSpy); } diff --git a/tests/operator/remember.ts b/tests/operator/remember.ts index 9bc19ec..49abe33 100644 --- a/tests/operator/remember.ts +++ b/tests/operator/remember.ts @@ -121,6 +121,13 @@ describe('Stream.prototype.remember', () => { done(); }); + it('should be a true bypass if input stream is a MemoryStream', (done) => { + const input = xs.createWithMemory(); + const stream: MemoryStream = input.remember(); + assert.strictEqual(stream, input); + done(); + }); + it('should not fail if original memorystream has no producer, and start is called', (done) => { const input = xs.createWithMemory(); assert.strictEqual(input instanceof MemoryStream, true);