Skip to content

Commit

Permalink
test: add thisArg deprecation tests (#6377)
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed May 10, 2021
1 parent f1b95cc commit a835adc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec-dtslint/observables/partition-spec.ts
Expand Up @@ -46,3 +46,10 @@ it('should support this with predicate', () => {
return val < limit;
}, thisArg);
});

it('should deprecate thisArg usage', () => {
const a = partition(of(1, 2, 3), Boolean); // $ExpectNoDeprecation
const b = partition(of(1, 2, 3), Boolean, {}); // $ExpectDeprecation
const c = partition(of(1, 2, 3), (value) => Boolean(value)); // $ExpectNoDeprecation
const d = partition(of(1, 2, 3), (value) => Boolean(value), {}); // $ExpectDeprecation
});
7 changes: 7 additions & 0 deletions spec-dtslint/operators/every-spec.ts
Expand Up @@ -51,4 +51,11 @@ it('should support this', () => {
const limit = this.limit; // $ExpectType number
return val < limit;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(every(Boolean)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(every(Boolean, {})); // $ExpectDeprecation
const c = of(1, 2, 3).pipe(every((value) => Boolean(value))); // $ExpectNoDeprecation
const d = of(1, 2, 3).pipe(every((value) => Boolean(value), {})); // $ExpectDeprecation
});
7 changes: 7 additions & 0 deletions spec-dtslint/operators/filter-spec.ts
Expand Up @@ -90,4 +90,11 @@ it('should support this', () => {
const limit = this.limit; // $ExpectType number
return val < limit;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(filter(Boolean)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(filter(Boolean, {})); // $ExpectDeprecation
const c = of(1, 2, 3).pipe(filter((value) => Boolean(value))); // $ExpectNoDeprecation
const d = of(1, 2, 3).pipe(filter((value) => Boolean(value), {})); // $ExpectDeprecation
});
7 changes: 7 additions & 0 deletions spec-dtslint/operators/find-spec.ts
Expand Up @@ -40,4 +40,11 @@ it('should support this', () => {
const wanted = this.wanted; // $ExpectType number
return val < wanted;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(find(Boolean)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(find(Boolean, {})); // $ExpectDeprecation
const c = of(1, 2, 3).pipe(find((value) => Boolean(value))); // $ExpectNoDeprecation
const d = of(1, 2, 3).pipe(find((value) => Boolean(value), {})); // $ExpectDeprecation
});
7 changes: 7 additions & 0 deletions spec-dtslint/operators/findIndex-spec.ts
Expand Up @@ -49,4 +49,11 @@ it('should support this', () => {
const wanted = this.wanted; // $ExpectType number
return val < wanted;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(findIndex(Boolean)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(findIndex(Boolean, {})); // $ExpectDeprecation
const c = of(1, 2, 3).pipe(findIndex((value) => Boolean(value))); // $ExpectNoDeprecation
const d = of(1, 2, 3).pipe(findIndex((value) => Boolean(value), {})); // $ExpectDeprecation
});
5 changes: 5 additions & 0 deletions spec-dtslint/operators/map-spec.ts
Expand Up @@ -33,3 +33,8 @@ it('should support this', () => {
return val < limit ? val : limit;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(map((value) => value)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(map((value) => value, {})); // $ExpectDeprecation
});

0 comments on commit a835adc

Please sign in to comment.