From bd0b6ca0db5ff9f6050efe842a80e156f5272977 Mon Sep 17 00:00:00 2001 From: Dkosasih Date: Thu, 27 Dec 2018 16:24:31 +1100 Subject: [PATCH] test(dtslint): add dtslint test for concat observable (#4093) (#4407) --- spec-dtslint/observables/concat-spec.ts | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 spec-dtslint/observables/concat-spec.ts diff --git a/spec-dtslint/observables/concat-spec.ts b/spec-dtslint/observables/concat-spec.ts new file mode 100644 index 0000000000..c3397910eb --- /dev/null +++ b/spec-dtslint/observables/concat-spec.ts @@ -0,0 +1,54 @@ +import { of, concat, asyncScheduler } from 'rxjs'; + +it('should accept 1 param', () => { + const o = concat(of(1)); // $ExpectType Observable +}); + +it('should accept 2 params', () => { + const o = concat(of(1), of(2)); // $ExpectType Observable +}); + +it('should accept 3 params', () => { + const o = concat(of(1), of(2), of(3)); // $ExpectType Observable +}); + +it('should accept 4 params', () => { + const o = concat(of(1), of(2), of(3), of(4)); // $ExpectType Observable +}); + +it('should accept 5 params', () => { + const o = concat(of(1), of(2), of(3), of(4), of(5)); // $ExpectType Observable +}); + +it('should accept 6 params', () => { + const o = concat(of(1), of(2), of(3), of(4), of(5), of(6)); // $ExpectType Observable +}); + +it('should accept more than 6 params', () => { + const o = concat(of(1), of(2), of(3), of(4), of(5), of(6), of(7), of(8), of(9)); // $ExpectType Observable +}); + +it('should accept scheduler after params', () => { + const o = concat(of(4), of(5), of(6), asyncScheduler); // $ExpectType Observable +}); + +it('should accept promises', () => { + const o = concat(Promise.resolve(4)); // $ExpectType Observable +}); + +it('should accept arrays', () => { + const o = concat([4, 5]); // $ExpectType Observable +}); + +it('should accept iterables', () => { + const o = concat([1], 'foo'); // $ExpectType Observable +}); + +it('should infer correctly with multiple types', () => { + const o = concat(of('foo'), Promise.resolve([1]), of(6)); // $ExpectType Observable +}); + +it('should enforce types', () => { + const o = concat(5); // $ExpectError + const p = concat(of(5), 6); // $ExpectError +});