Skip to content

Commit 69654fe

Browse files
committed
Added test cases
1 parent f701574 commit 69654fe

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import {
2+
ManagementClient,
3+
UserAttributeProfilesManager,
4+
GetUserAttributeProfilesByIdRequest,
5+
CreateUserAttributeProfileRequestContent,
6+
UpdateUserAttributeProfileRequestContent,
7+
DeleteUserAttributeProfilesByIdRequest,
8+
GetUserAttributeProfileTemplateRequest,
9+
} from '../../src/index.js';
10+
11+
import { checkMethod } from './tests.util.js';
12+
13+
const DOMAIN = `tenant.auth0.com`;
14+
const token = 'TOKEN';
15+
16+
describe('UserAttributeProfilesManager', () => {
17+
const userAttributeProfilesManager: UserAttributeProfilesManager = new ManagementClient({
18+
domain: DOMAIN,
19+
token,
20+
}).userAttributeProfiles;
21+
22+
// this is the test for the method userAttributeProfilesManager.getAll
23+
describe('getAll', () => {
24+
const operation = userAttributeProfilesManager.getAll();
25+
const uri = `/user-attribute-profiles`;
26+
const method = 'get';
27+
28+
checkMethod({ operation, uri, method });
29+
});
30+
31+
// this is the test for the method userAttributeProfilesManager.get
32+
describe('get', () => {
33+
const requestParameters: GetUserAttributeProfilesByIdRequest = {
34+
id: 'id',
35+
};
36+
const operation = userAttributeProfilesManager.get(requestParameters);
37+
const uri = `/user-attribute-profiles/id`;
38+
const method = 'get';
39+
40+
checkMethod({ operation, uri, method });
41+
});
42+
43+
// this is the test for the method userAttributeProfilesManager.update
44+
describe('update', () => {
45+
const requestParameters: GetUserAttributeProfilesByIdRequest = {
46+
id: 'id',
47+
};
48+
const updatePayload: UpdateUserAttributeProfileRequestContent = {
49+
user_id: {
50+
scim_mapping: 'customMappingValue',
51+
saml_mapping: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier',
52+
oidc_mapping: 'sub',
53+
},
54+
};
55+
const operation = userAttributeProfilesManager.update(requestParameters, updatePayload);
56+
const uri = `/user-attribute-profiles/id`;
57+
const method = 'patch';
58+
59+
checkMethod({ operation, uri, method });
60+
});
61+
62+
// this is the test for the method userAttributeProfilesManager.create
63+
describe('create', () => {
64+
const createPayload: CreateUserAttributeProfileRequestContent = {
65+
name: 'Test',
66+
user_attributes: {
67+
username: {
68+
description: 'This is just a test',
69+
label: 'testUser',
70+
profile_required: false,
71+
auth0_mapping: 'testUser',
72+
oidc_mapping: 'preferred_username',
73+
},
74+
},
75+
};
76+
const operation = userAttributeProfilesManager.create(createPayload);
77+
const uri = `/user-attribute-profiles`;
78+
const method = 'post';
79+
80+
checkMethod({ operation, uri, method });
81+
});
82+
83+
// this is the test for the method userAttributeProfilesManager.delete
84+
describe('delete', () => {
85+
const requestParameters: DeleteUserAttributeProfilesByIdRequest = {
86+
id: 'id',
87+
};
88+
const operation = userAttributeProfilesManager.delete(requestParameters);
89+
const uri = `/user-attribute-profiles/id`;
90+
const method = 'delete';
91+
92+
checkMethod({ operation, uri, method });
93+
});
94+
95+
// this is the test for the method userAttributeProfilesManager.getAllTemplates
96+
describe('getAllTemplates', () => {
97+
const operation = userAttributeProfilesManager.getAllTemplates();
98+
const uri = `/user-attribute-profiles/templates`;
99+
const method = 'get';
100+
101+
checkMethod({ operation, uri, method });
102+
});
103+
104+
// this is the test for the method userAttributeProfilesManager.getTemplate
105+
describe('getTemplate', () => {
106+
const requestParameters: GetUserAttributeProfileTemplateRequest = {
107+
id: 'id',
108+
};
109+
const operation = userAttributeProfilesManager.getTemplate(requestParameters);
110+
const uri = `/user-attribute-profiles/templates/id`;
111+
const method = 'get';
112+
113+
checkMethod({ operation, uri, method });
114+
});
115+
});

0 commit comments

Comments
 (0)