-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.test-d.ts
69 lines (53 loc) · 2.6 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
59
60
61
62
63
64
65
66
67
68
69
import {expectType} from 'tsd'
import {
createClient,
Client,
Change,
SearchCallbackResponse,
SearchEntry,
SearchReference
} from '.'
expectType<Client>(createClient())
const client = createClient()
expectType<Promise<void>>(client.bind('cn=foo', 'bar'))
expectType<Promise<void>>(client.bind('cn=foo', 'bar', {}))
expectType<Promise<void>>(client.bind('cn=foo', 'bar', []))
expectType<Promise<void>>(client.bind('cn=foo', 'bar', [{}]))
expectType<Promise<void>>(client.add('cn=foo', {}))
expectType<Promise<void>>(client.add('cn=foo', {}, []))
expectType<Promise<void>>(client.add('cn=foo', {}, {}))
expectType<Promise<boolean | undefined>>(client.compare('cn=foo', 'bar', 'baz'))
expectType<Promise<boolean | undefined>>(client.compare('cn=foo', 'bar', 'baz', {}))
expectType<Promise<boolean | undefined>>(client.compare('cn=foo', 'bar', 'baz', []))
expectType<Promise<void>>(client.del('cn=foo'))
expectType<Promise<void>>(client.del('cn=foo', {}))
expectType<Promise<{ value: string, response: any }>>(client.exop('cn=foo', 'bar'))
expectType<Promise<{ value: string, response: any }>>(client.exop('cn=foo', 'bar', {}))
const change: Change = {
operation: 'op',
modification: {}
}
expectType<Promise<void>>(client.modify('cn=foo', change))
expectType<Promise<void>>(client.modify('cn=foo', [change]))
expectType<Promise<void>>(client.modify('cn=foo', [change], []))
expectType<Promise<void>>(client.modifyDN('cn=foo', 'bar'))
expectType<Promise<void>>(client.modifyDN('cn=foo', 'bar', []))
expectType<Promise<SearchCallbackResponse>>(client.search('cn=foo'))
expectType<Promise<SearchCallbackResponse>>(client.search('cn=foo', {scope: 'sub'}))
expectType<Promise<SearchCallbackResponse>>(client.search('cn=foo', {filter: '(objectclass=*)'}))
expectType<Promise<SearchCallbackResponse>>(client.search('cn=foo', {filter: '(objectclass=*)'}, {}))
expectType<Promise<void>>(client.starttls('cn=foo'))
expectType<Promise<void>>(client.starttls('cn=foo', {}))
expectType<Promise<void>>(client.unbind())
expectType<Promise<void>>(client.destroy())
expectType<Promise<void>>(client.destroy(new Error()))
type SearchResult = {
entries: SearchEntry[],
referrals: SearchReference[]
}
expectType<Promise<SearchResult>>(client.searchReturnAll('cn=foo'))
expectType<Promise<SearchResult>>(client.searchReturnAll('cn=foo', {scope: 'base'}))
expectType<Promise<SearchResult>>(client.searchReturnAll('cn=foo', {scope: 'base'}, []))
expectType<Promise<any>>(client.findUser('cn=foo', 'bar'))
expectType<Promise<any>>(client.findUser('cn=foo', 'bar', {scope: 'sub'}))
expectType<Promise<boolean>>(client.userInGroup('cn=foo', 'bar', 'baz'))