-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.test-d.ts
58 lines (44 loc) · 1.88 KB
/
index.test-d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {expectError, expectType} from 'tsd';
import any from '.';
expectType<{ [key: string]: string }>(any.simpleObject());
expectType<{ a: number, b: number, c: number }>(any.objectWithKeys(['a', 'b', 'c'], {factory: any.integer()}));
expectError(any.objectWithKeys())
expectType<string | number>(any.fromList(['a', 1]))
expectError(any.fromList())
expectType<string[]>(any.subList(['a', 'b', 'c']))
expectType<string[]>(any.subList(['a', 'b', 'c'], {size: 2}))
expectError(any.subList())
expectType<string>(any.string());
expectType<string>(any.string({length: 1}));
expectType<string>(any.string({length: 1, alpha: true, pool: 'abcde', casing: 'lower', numeric: true, symbols: true}));
expectType<string>(any.word())
expectType<string>(any.word({length: 1}))
expectType<string>(any.word({length: 1, capitalize: true}))
expectType<string>(any.word({length: 1, capitalize: true, syllables: 1}))
expectType<string>(any.sentence())
expectType<string>(any.sentence({words: 1}))
expectType<string>(any.sentence({words: 1, punctuation: '.'}))
expectType<string>(any.paragraph())
expectType<string>(any.paragraph({sentences: 1}))
expectType<number>(any.integer())
expectType<number>(any.integer({min: 1}))
expectType<number>(any.integer({min: 1, max: 2}))
expectType<number>(any.float())
expectType<number>(any.float({min: 1}))
expectType<number>(any.float({min: 1, max: 2}))
expectType<number>(any.float({min: 1, max: 2, fixed: 4}))
expectType<boolean>(any.boolean())
expectType<boolean>(any.boolean({likelihood: 30}))
expectType<string>(any.url());
expectType<string>(any.url({protocol: 'https'}));
expectType<string>(any.url({
protocol: 'https',
domain: 'google',
domain_prefix: 'a',
path: 'search',
extensions: ['.jpg']
}));
expectType<string>(any.email());
expectType<string>(any.email({length: 1}));
expectType<string>(any.email({length: 1, domain: 'gmail.com'}));
expectType<string>(any.date());