-
Notifications
You must be signed in to change notification settings - Fork 1
/
groups.generated.test.ts
68 lines (68 loc) · 2.98 KB
/
groups.generated.test.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
import { serializeGroups } from '../schemas.generated.js';
import { deserializeGroups } from '../schemas.generated.js';
import { serializeGroupFull } from '../schemas.generated.js';
import { deserializeGroupFull } from '../schemas.generated.js';
import { serializeCreateGroupRequestBody } from '../managers/groups.generated.js';
import { deserializeCreateGroupRequestBody } from '../managers/groups.generated.js';
import { serializeUpdateGroupByIdRequestBody } from '../managers/groups.generated.js';
import { deserializeUpdateGroupByIdRequestBody } from '../managers/groups.generated.js';
import { BoxClient } from '../client.generated.js';
import { Groups } from '../schemas.generated.js';
import { GroupFull } from '../schemas.generated.js';
import { CreateGroupRequestBody } from '../managers/groups.generated.js';
import { GetGroupByIdQueryParams } from '../managers/groups.generated.js';
import { UpdateGroupByIdRequestBody } from '../managers/groups.generated.js';
import { getUuid } from '../internal/utils.js';
import { getDefaultClient } from './commons.generated.js';
import { SerializedData } from '../serialization/json.js';
import { sdIsEmpty } from '../serialization/json.js';
import { sdIsBoolean } from '../serialization/json.js';
import { sdIsNumber } from '../serialization/json.js';
import { sdIsString } from '../serialization/json.js';
import { sdIsList } from '../serialization/json.js';
import { sdIsMap } from '../serialization/json.js';
export const client: BoxClient = getDefaultClient();
test('test_get_groups', async function test_get_groups(): Promise<any> {
const groups: Groups = await client.groups.getGroups();
if (!(groups.totalCount! >= 0)) {
throw new Error('Assertion failed');
}
});
test('test_create_get_delete_group', async function test_create_get_delete_group(): Promise<any> {
const groupName: string = getUuid();
const groupDescription: string = 'Group description';
const group: GroupFull = await client.groups.createGroup({
name: groupName,
description: groupDescription,
} satisfies CreateGroupRequestBody);
if (!(group.name == groupName)) {
throw new Error('Assertion failed');
}
const groupById: GroupFull = await client.groups.getGroupById(group.id, {
fields: [
'id' as string,
'name' as string,
'description' as string,
'group_type' as string,
],
} satisfies GetGroupByIdQueryParams);
if (!(groupById.id == group.id)) {
throw new Error('Assertion failed');
}
if (!(groupById.description == groupDescription)) {
throw new Error('Assertion failed');
}
const updatedGroupName: string = getUuid();
const updatedGroup: GroupFull = await client.groups.updateGroupById(
group.id,
{ name: updatedGroupName } satisfies UpdateGroupByIdRequestBody
);
if (!(updatedGroup.name == updatedGroupName)) {
throw new Error('Assertion failed');
}
await client.groups.deleteGroupById(group.id);
await expect(async () => {
await client.groups.getGroupById(group.id);
}).rejects.toThrow();
});
export {};