-
Notifications
You must be signed in to change notification settings - Fork 0
/
authClientForwardedUser.test-d.ts
63 lines (60 loc) · 2.04 KB
/
authClientForwardedUser.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
import { expectType } from 'tsd'
// #region import
import HypothesisRestClient, {
type AuthClientForwardedUserClient
} from '../../src/HypothesisRest'
// #endregion import
// #region imports
import type { Group } from '../../src/Group'
import type { IndexResponse } from '../../src/api/root'
import { type Result } from '../../src/api/search'
import { GROUP_ID, NEW_GROUP, QUERY } from '../fixtures'
// #endregion imports
export default async () => {
// #region instantiation
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
expectType<AuthClientForwardedUserClient>(client)
// #endregion instantiation
}
export const endpoints = {
'GET /': async () => {
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
// #region root
expectType<IndexResponse>(
await client.root()
)
// #endregion root
},
'GET /search': async () => {
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
// #region search
expectType<Result>(
await client.search(QUERY)
)
// #endregion search
},
'POST /groups': async () => {
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
// #region createGroup
expectType<Group>(
await client.groups.createGroup(NEW_GROUP)
)
// #endregion createGroup
},
'PATCH /groups/{id}': async () => {
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
// #region updateGroup
expectType<Group>(
await client.groups.updateGroup(GROUP_ID, NEW_GROUP)
)
// #endregion updateGroup
},
'PUT /groups/{id}': async () => {
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
// #region createOrUpdateGroup
expectType<Group>(
await client.groups.createOrUpdateGroup(GROUP_ID, NEW_GROUP)
)
// #endregion createOrUpdateGroup
}
}