@@ -125,6 +125,24 @@ describe('Player API service - identify', () => {
125
125
expect ( res . body ) . toStrictEqual ( { message : 'Player not found: Talo aliases must be created using the /v1/players/auth API' } )
126
126
} )
127
127
128
+ it ( 'should require the service to be set' , async ( ) => {
129
+ const [ apiKey , token ] = await createAPIKeyAndToken ( [ APIKeyScope . READ_PLAYERS ] )
130
+ const player = await new PlayerFactory ( [ apiKey . game ] ) . one ( )
131
+ await ( < EntityManager > global . em ) . persistAndFlush ( player )
132
+
133
+ const res = await request ( global . app )
134
+ . get ( '/v1/players/identify' )
135
+ . query ( { identifier : player . aliases [ 0 ] . identifier } )
136
+ . auth ( token , { type : 'bearer' } )
137
+ . expect ( 400 )
138
+
139
+ expect ( res . body ) . toStrictEqual ( {
140
+ errors : {
141
+ service : [ 'service is missing from the request query' ]
142
+ }
143
+ } )
144
+ } )
145
+
128
146
it ( 'should require the service to be a non-empty string' , async ( ) => {
129
147
const [ apiKey , token ] = await createAPIKeyAndToken ( [ APIKeyScope . READ_PLAYERS ] )
130
148
const player = await new PlayerFactory ( [ apiKey . game ] ) . one ( )
@@ -143,6 +161,24 @@ describe('Player API service - identify', () => {
143
161
} )
144
162
} )
145
163
164
+ it ( 'should require the identifier to be set' , async ( ) => {
165
+ const [ apiKey , token ] = await createAPIKeyAndToken ( [ APIKeyScope . READ_PLAYERS ] )
166
+ const player = await new PlayerFactory ( [ apiKey . game ] ) . one ( )
167
+ await ( < EntityManager > global . em ) . persistAndFlush ( player )
168
+
169
+ const res = await request ( global . app )
170
+ . get ( '/v1/players/identify' )
171
+ . query ( { service : player . aliases [ 0 ] . service } )
172
+ . auth ( token , { type : 'bearer' } )
173
+ . expect ( 400 )
174
+
175
+ expect ( res . body ) . toStrictEqual ( {
176
+ errors : {
177
+ identifier : [ 'identifier is missing from the request query' ]
178
+ }
179
+ } )
180
+ } )
181
+
146
182
it ( 'should require the identifier to be a non-empty string' , async ( ) => {
147
183
const [ apiKey , token ] = await createAPIKeyAndToken ( [ APIKeyScope . READ_PLAYERS ] )
148
184
const player = await new PlayerFactory ( [ apiKey . game ] ) . one ( )
0 commit comments