-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(typings): standardize the way how we do tests
Ref #978
- Loading branch information
Showing
14 changed files
with
85 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
import { customIterable } from './helpers'; | ||
|
||
RA.allEqual([1, 2, 3, 4]); // $ExpectType boolean | ||
RA.allEqual(['a', 'b', 'c', 'd']); // $ExpectType boolean | ||
RA.allEqual([1, 'b', 2, 'd']); // $ExpectType boolean | ||
RA.allEqual([]); // $ExpectType boolean | ||
|
||
RA.allEqual(1); // $ExpectError | ||
RA.allEqual({}); // $ExpectError | ||
RA.allEqual(customIterable); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import * as RA from "ramda-adjunct"; | ||
|
||
import { customIterable } from './helpers'; | ||
|
||
RA.allEqualTo(1, [1, 2, 3, 4]); // $ExpectType boolean | ||
RA.allEqualTo(1, []); // $ExpectType boolean | ||
RA.allEqualTo(1)([1, 2, 3, 4]); // $ExpectType boolean | ||
RA.allEqualTo(1)([]); // $ExpectType boolean | ||
|
||
RA.allEqualTo(1, {}); // $ExpectError | ||
RA.allEqualTo(1, 'a'); // $ExpectError | ||
RA.allEqualTo(1, customIterable); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import * as RA from "ramda-adjunct"; | ||
|
||
import { customIterable } from './helpers'; | ||
|
||
RA.allIdentical([1, 2, 3, 4]); // $ExpectType boolean | ||
RA.allIdentical([]); // $ExpectType boolean | ||
|
||
RA.allIdentical({}); // $ExpectError | ||
RA.allIdentical('a'); // $ExpectError | ||
RA.allIdentical(customIterable); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import * as RA from "ramda-adjunct"; | ||
|
||
import { customIterable } from './helpers'; | ||
|
||
RA.allIdenticalTo(1, [1, 2, 3, 4]); // $ExpectType boolean | ||
RA.allIdenticalTo(1, []); // $ExpectType boolean | ||
RA.allIdenticalTo(1)([]); // $ExpectType boolean | ||
|
||
RA.allIdenticalTo('a', [1, 2]); // $ExpectError | ||
RA.allIdenticalTo(1, customIterable); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
/** | ||
* Helpers. | ||
*/ | ||
|
||
const customIterable = { | ||
*[Symbol.iterator](): IterableIterator<number> { | ||
yield 1; | ||
yield 2; | ||
yield 3; | ||
}, | ||
}; | ||
|
||
/** | ||
* Tests. | ||
*/ | ||
import { customIterable } from './helpers'; | ||
|
||
RA.allP([1, 2]); // $ExpectType Promise<number[]> | ||
RA.allP(['a', 'b']); // $ExpectType Promise<string[]> | ||
RA.allP([1, 'a']); // $ExpectType Promise<(string | number)[]> | ||
RA.allP([]); // $ExpectType Promise<never[]> | ||
RA.allP(customIterable); // $ExpectType Promise<number[]> | ||
RA.allP('abc'); // $ExpectType Promise<string[]> | ||
|
||
RA.allP({}); // $ExpectError | ||
RA.allP(1); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
/** | ||
* Helpers. | ||
*/ | ||
|
||
const customIterable = { | ||
*[Symbol.iterator](): IterableIterator<number> { | ||
yield 1; | ||
yield 2; | ||
yield 3; | ||
}, | ||
}; | ||
|
||
/** | ||
* Tests. | ||
*/ | ||
import { customIterable } from './helpers'; | ||
|
||
RA.allSettledP([1, 2]); // $ExpectType Promise<SettledPromise<number>[]> | ||
RA.allSettledP(['a', 'b']); // $ExpectType Promise<SettledPromise<string>[]> | ||
RA.allSettledP([1, 'a']); // $ExpectType Promise<SettledPromise<string | number>[]> | ||
RA.allSettledP([]); // $ExpectType Promise<SettledPromise<never>[]> | ||
RA.allSettledP(customIterable); // $ExpectType Promise<SettledPromise<number>[]> | ||
RA.allSettledP('abc'); // $ExpectType Promise<SettledPromise<string>[]> | ||
|
||
RA.allSettledP({}); // $ExpectError | ||
RA.allSettledP(1); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
/** | ||
* Helpers. | ||
*/ | ||
|
||
const customIterable = { | ||
*[Symbol.iterator](): IterableIterator<number> { | ||
yield 1; | ||
yield 2; | ||
yield 3; | ||
}, | ||
}; | ||
|
||
/** | ||
* Tests. | ||
*/ | ||
import { customIterable } from './helpers'; | ||
|
||
RA.anyP([1, 2]); // $ExpectType Promise<number> | ||
RA.anyP(['a', 'b']); // $ExpectType Promise<string> | ||
RA.anyP([1, 'a']); // $ExpectType Promise<string | number> | ||
RA.anyP([]); // $ExpectType Promise<never> | ||
RA.anyP(customIterable); // $ExpectType Promise<number> | ||
|
||
RA.anyP({}); // $ExpectError | ||
RA.anyP(1); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
import { customIterable } from './helpers'; | ||
|
||
RA.appendFlipped([1, 2], 3); // $ExpectType number[] | ||
RA.appendFlipped(['a', 'b'], 'c'); // $ExpectType string[] | ||
RA.appendFlipped(['a', 2], 3); // $ExpectType (string | number)[] | ||
RA.appendFlipped<number>([1, 2], 3); // $ExpectType number[] | ||
RA.appendFlipped<string>(['a', 'b'], 'c'); // $ExpectType string[] | ||
|
||
RA.appendFlipped<string>([1, 'b'], 'c'); // $ExpectError | ||
RA.appendFlipped<string>([1, 'b'])('c'); // $ExpectError | ||
RA.appendFlipped(1, 'c'); // $ExpectError | ||
RA.appendFlipped(1)('c'); // $ExpectError | ||
RA.appendFlipped(customIterable, 'c'); // $ExpectError | ||
RA.appendFlipped(customIterable)('c'); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import * as RA from 'ramda-adjunct'; | ||
|
||
RA.escapeRegExp('abc'); // $ExpectType string | ||
RA.escapeRegExp(1); // $ExpectType 1 | ||
RA.escapeRegExp({}); // $ExpectType {} | ||
RA.escapeRegExp<number>(1); // $ExpectType number | ||
RA.escapeRegExp<null>(null); // $ExpectType null | ||
RA.escapeRegExp<undefined>(undefined); // $ExpectType undefined | ||
RA.escapeRegExp(''); // $ExpectType string | ||
|
||
// tslint:disable-next-line:no-construct | ||
RA.escapeRegExp(new String('')); // $ExpectError | ||
RA.escapeRegExp(1); // $ExpectError | ||
RA.escapeRegExp({}); // $ExpectError | ||
RA.escapeRegExp(null); // $ExpectError | ||
RA.escapeRegExp(undefined); // $ExpectError | ||
RA.escapeRegExp([]); // $ExpectError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const customIterable: Iterable<number> = { | ||
*[Symbol.iterator](): IterableIterator<number> { | ||
yield 1; | ||
yield 2; | ||
yield 3; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters