@@ -77,7 +77,7 @@ describe("Function: getComments", () => {
7777 expect ( response ) . toEqual ( expectedResponse ) ;
7878 } ) ;
7979
80- it ( "retrieves the comments on an game or achievement " , async ( ) => {
80+ it ( "retrieves the comments on an game" , async ( ) => {
8181 // ARRANGE
8282 const authorization = buildAuthorization ( {
8383 username : "mockUserName" ,
@@ -110,6 +110,7 @@ describe("Function: getComments", () => {
110110 // ACT
111111 const response = await getComments ( authorization , {
112112 identifier : 321_865 ,
113+ kind : 1 ,
113114 } ) ;
114115
115116 // ASSERT
@@ -133,7 +134,7 @@ describe("Function: getComments", () => {
133134 expect ( response ) . toEqual ( expectedResponse ) ;
134135 } ) ;
135136
136- it ( "retrieves the comments on an game or achievement, respecting count" , async ( ) => {
137+ it ( "retrieves the comments on an achievement, respecting count" , async ( ) => {
137138 // ARRANGE
138139 const authorization = buildAuthorization ( {
139140 username : "mockUserName" ,
@@ -167,6 +168,7 @@ describe("Function: getComments", () => {
167168 const response = await getComments ( authorization , {
168169 identifier : 321_865 ,
169170 count : 2 ,
171+ kind : 2 ,
170172 } ) ;
171173
172174 // ASSERT
@@ -190,7 +192,7 @@ describe("Function: getComments", () => {
190192 expect ( response ) . toEqual ( expectedResponse ) ;
191193 } ) ;
192194
193- it ( "retrieves the comments on an game or achievement , respecting offset" , async ( ) => {
195+ it ( "retrieves the comments on an game, respecting offset" , async ( ) => {
194196 // ARRANGE
195197 const authorization = buildAuthorization ( {
196198 username : "mockUserName" ,
@@ -219,6 +221,7 @@ describe("Function: getComments", () => {
219221 const response = await getComments ( authorization , {
220222 identifier : 321_865 ,
221223 offset : 1 ,
224+ kind : 1 ,
222225 } ) ;
223226
224227 // ASSERT
@@ -236,4 +239,39 @@ describe("Function: getComments", () => {
236239
237240 expect ( response ) . toEqual ( expectedResponse ) ;
238241 } ) ;
242+
243+ it ( "warns the developer when they don't specify kind for achievements/games" , async ( ) => {
244+ // ARRANGE
245+ const authorization = buildAuthorization ( {
246+ username : "mockUserName" ,
247+ webApiKey : "mockWebApiKey" ,
248+ } ) ;
249+
250+ const mockResponse : GetCommentsResponse = {
251+ Count : 1 ,
252+ Total : 2 ,
253+ Results : [
254+ {
255+ User : "PlayTester" ,
256+ Submitted : "2024-07-31T11:22:23.000000Z" ,
257+ CommentText : "Comment 2" ,
258+ } ,
259+ ] ,
260+ } ;
261+
262+ server . use (
263+ http . get ( `${ apiBaseUrl } /API_GetComments.php` , ( ) =>
264+ HttpResponse . json ( mockResponse )
265+ )
266+ ) ;
267+
268+ // ACT
269+ const response = getComments ( authorization , {
270+ identifier : 321_865 ,
271+ offset : 1 ,
272+ } ) ;
273+
274+ // ASSERT
275+ await expect ( response ) . rejects . toThrow ( TypeError ) ;
276+ } ) ;
239277} ) ;
0 commit comments