@@ -25,7 +25,7 @@ const {
2525 _postThemesEvents,
2626 _putThemesEvents,
2727 _deleteThemesEventsById,
28- _putItemsByIdThemes ,
28+ _putItemsByBaseIdThemes ,
2929 _putItemsThemes,
3030 _deleteItemsThemes,
3131} = vi . hoisted ( ( ) => ( {
@@ -37,7 +37,7 @@ const {
3737 _postThemesEvents : vi . fn ( ) ,
3838 _putThemesEvents : vi . fn ( ) ,
3939 _deleteThemesEventsById : vi . fn ( ) ,
40- _putItemsByIdThemes : vi . fn ( ) ,
40+ _putItemsByBaseIdThemes : vi . fn ( ) ,
4141 _putItemsThemes : vi . fn ( ) ,
4242 _deleteItemsThemes : vi . fn ( ) ,
4343} ) )
@@ -51,7 +51,7 @@ vi.mock('#api/sdk.gen', () => ({
5151 postThemesEvents : _postThemesEvents ,
5252 putThemesEvents : _putThemesEvents ,
5353 deleteThemesEventsById : _deleteThemesEventsById ,
54- putItemsByIdThemes : _putItemsByIdThemes ,
54+ putItemsByBaseIdThemes : _putItemsByBaseIdThemes ,
5555 putItemsThemes : _putItemsThemes ,
5656 deleteItemsThemes : _deleteItemsThemes ,
5757} ) )
@@ -163,30 +163,30 @@ describe('theme service', () => {
163163 } )
164164
165165 describe ( 'item themes' , ( ) => {
166- it ( 'setItemThemes puts the theme ids to the item route and unwraps the item' , async ( ) => {
166+ it ( 'setItemThemes puts the theme ids to the item family route and unwraps the item' , async ( ) => {
167167 const item = { id : 'sword_1' , themes : [ { id : 1 , name : 'Viking' } ] }
168- _putItemsByIdThemes . mockResolvedValueOnce ( { data : item , errors : null } )
168+ _putItemsByBaseIdThemes . mockResolvedValueOnce ( { data : item , errors : null } )
169169
170- const result = await setItemThemes ( 'sword_1 ' , [ 1 ] )
170+ const result = await setItemThemes ( 'sword ' , [ 1 ] )
171171
172- expect ( _putItemsByIdThemes ) . toHaveBeenCalledWith ( { path : { id : 'sword_1 ' } , body : { themeIds : [ 1 ] } } )
172+ expect ( _putItemsByBaseIdThemes ) . toHaveBeenCalledWith ( { path : { baseId : 'sword ' } , body : { themeIds : [ 1 ] } } )
173173 expect ( result ) . toEqual ( item )
174174 } )
175175
176- it ( 'addThemesToItems puts the items and themes in the body' , async ( ) => {
176+ it ( 'addThemesToItems puts the base ids and themes in the body' , async ( ) => {
177177 _putItemsThemes . mockResolvedValueOnce ( { data : undefined , errors : null } )
178178
179- await addThemesToItems ( [ 'sword_1 ' , 'axe_2 ' ] , [ 1 , 2 ] )
179+ await addThemesToItems ( [ 'sword ' , 'axe ' ] , [ 1 , 2 ] )
180180
181- expect ( _putItemsThemes ) . toHaveBeenCalledWith ( { body : { itemIds : [ 'sword_1 ' , 'axe_2 ' ] , themeIds : [ 1 , 2 ] } } )
181+ expect ( _putItemsThemes ) . toHaveBeenCalledWith ( { body : { baseIds : [ 'sword ' , 'axe ' ] , themeIds : [ 1 , 2 ] } } )
182182 } )
183183
184- it ( 'removeThemesFromItems deletes with the items and themes in the body' , async ( ) => {
184+ it ( 'removeThemesFromItems deletes with the base ids and themes in the body' , async ( ) => {
185185 _deleteItemsThemes . mockResolvedValueOnce ( { data : undefined , errors : null } )
186186
187- await removeThemesFromItems ( [ 'sword_1 ' ] , [ 3 ] )
187+ await removeThemesFromItems ( [ 'sword ' ] , [ 3 ] )
188188
189- expect ( _deleteItemsThemes ) . toHaveBeenCalledWith ( { body : { itemIds : [ 'sword_1 ' ] , themeIds : [ 3 ] } } )
189+ expect ( _deleteItemsThemes ) . toHaveBeenCalledWith ( { body : { baseIds : [ 'sword ' ] , themeIds : [ 3 ] } } )
190190 } )
191191 } )
192192} )
0 commit comments