1
1
import crypto from 'crypto' ;
2
2
import Zitadel from '../src/index.js' ;
3
3
// noinspection ES6PreferShortImport
4
- import {
5
- UserServiceAddHumanUserResponse ,
6
- UserServiceUser ,
7
- } from '../src/models/index.js' ;
4
+ import { UserServiceAddHumanUserResponse , UserServiceUser , } from '../src/models/index.js' ;
8
5
// noinspection ES6PreferShortImport
9
6
import { ApiException } from '../src/api-exception.js' ;
10
7
import { useIntegrationEnvironment } from './base-spec.js' ;
@@ -53,15 +50,17 @@ describe('UserServiceSanityCheckSpec', () => {
53
50
} ,
54
51
} ,
55
52
} ;
56
- user = await client . users . userServiceAddHumanUser ( request ) ;
53
+ user = await client . users . addHumanUser ( request ) ;
57
54
} ) ;
58
55
59
56
/**
60
57
* Remove the created human user after each test.
61
58
*/
62
59
afterEach ( async ( ) => {
63
60
try {
64
- await client . users . userServiceDeleteUser ( { userId : user . userId || '' } ) ;
61
+ await client . users . deleteUser ( {
62
+ userServiceDeleteUserRequest : { userId : user . userId || '' } ,
63
+ } ) ;
65
64
} catch {
66
65
// cleanup errors ignored
67
66
}
@@ -73,8 +72,10 @@ describe('UserServiceSanityCheckSpec', () => {
73
72
* @throws ApiException on API error
74
73
*/
75
74
it ( 'testRetrievesTheUserDetailsById' , async ( ) => {
76
- const response = await client . users . userServiceGetUserByID ( {
77
- userId : user . userId || '' ,
75
+ const response = await client . users . getUserByID ( {
76
+ userServiceGetUserByIDRequest : {
77
+ userId : user . userId || '' ,
78
+ } ,
78
79
} ) ;
79
80
expect ( response . user ?. userId ) . toBe ( user . userId ) ;
80
81
} ) ;
@@ -90,7 +91,7 @@ describe('UserServiceSanityCheckSpec', () => {
90
91
queries : [ ] ,
91
92
} ,
92
93
} ;
93
- const response = await client . users . userServiceListUsers ( request ) ;
94
+ const response = await client . users . listUsers ( request ) ;
94
95
const userIds = response . result ?. map (
95
96
( userItem : UserServiceUser ) => userItem . userId ,
96
97
) ;
@@ -105,17 +106,19 @@ describe('UserServiceSanityCheckSpec', () => {
105
106
it ( 'testUpdatesTheUserEmailAndReflectsInGet' , async ( ) => {
106
107
const newEmail = `updated_${ crypto . randomUUID ( ) . substring ( 0 , 8 ) } @example.com` ;
107
108
108
- await client . users . userServiceUpdateHumanUser ( {
109
- userId : user . userId || '' ,
110
- userServiceUpdateHumanUserRequest : {
111
- email : {
112
- email : newEmail ,
109
+ await client . users . updateUser ( {
110
+ userServiceUpdateUserRequest : {
111
+ userId : user . userId || '' ,
112
+ human : {
113
+ email : { email : newEmail } ,
113
114
} ,
114
115
} ,
115
116
} ) ;
116
117
117
- const response = await client . users . userServiceGetUserByID ( {
118
- userId : user . userId || '' ,
118
+ const response = await client . users . getUserByID ( {
119
+ userServiceGetUserByIDRequest : {
120
+ userId : user . userId || '' ,
121
+ } ,
119
122
} ) ;
120
123
expect ( response . user ?. human ?. email ?. email ) . toContain ( 'updated' ) ;
121
124
} ) ;
@@ -126,7 +129,9 @@ describe('UserServiceSanityCheckSpec', () => {
126
129
it ( 'testRaisesAnApiExceptionWhenRetrievingNonExistentUser' , async ( ) => {
127
130
const nonExistentId = crypto . randomUUID ( ) ;
128
131
await expect (
129
- client . users . userServiceGetUserByID ( { userId : nonExistentId } ) ,
132
+ client . users . getUserByID ( {
133
+ userServiceGetUserByIDRequest : { userId : nonExistentId } ,
134
+ } ) ,
130
135
) . rejects . toThrow ( ApiException ) ;
131
136
} ) ;
132
137
} ) ;
0 commit comments